@ibiz-template/runtime 0.2.18-dev.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/index.esm.js +250 -170
  2. package/dist/index.system.min.js +2 -2
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
  5. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +2 -1
  6. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +6 -0
  7. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
  8. package/out/controller/control/form/form-detail/form-item/form-item.controller.js +16 -3
  9. package/out/controller/control/panel/panel/panel-item.controller.d.ts.map +1 -1
  10. package/out/controller/control/panel/panel/panel-item.controller.js +2 -1
  11. package/out/controller/utils/data-file-util/data-file-util.d.ts +1 -1
  12. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
  13. package/out/controller/utils/data-file-util/data-file-util.js +10 -23
  14. package/out/install.d.ts.map +1 -1
  15. package/out/install.js +3 -1
  16. package/out/interface/controller/event/argument/form-detail.event.d.ts +24 -2
  17. package/out/interface/controller/event/argument/form-detail.event.d.ts.map +1 -1
  18. package/out/interface/controller/event/argument/form-detail.event.js +24 -1
  19. package/out/interface/controller/event/argument/index.d.ts +2 -0
  20. package/out/interface/controller/event/argument/index.d.ts.map +1 -1
  21. package/out/interface/controller/event/argument/index.js +2 -1
  22. package/out/interface/controller/event/argument/panel-item.event.d.ts +23 -1
  23. package/out/interface/controller/event/argument/panel-item.event.d.ts.map +1 -1
  24. package/out/interface/controller/event/argument/panel-item.event.js +24 -1
  25. package/out/interface/provider/i-async-action.provider.d.ts +27 -0
  26. package/out/interface/provider/i-async-action.provider.d.ts.map +1 -0
  27. package/out/interface/provider/i-async-action.provider.js +1 -0
  28. package/out/interface/provider/index.d.ts +1 -0
  29. package/out/interface/provider/index.d.ts.map +1 -1
  30. package/out/interface/service/service/i-async-action.service.d.ts +28 -0
  31. package/out/interface/service/service/i-async-action.service.d.ts.map +1 -0
  32. package/out/interface/service/service/i-async-action.service.js +1 -0
  33. package/out/interface/service/service/index.d.ts +1 -0
  34. package/out/interface/service/service/index.d.ts.map +1 -1
  35. package/out/register/helper/async-action-register.d.ts +22 -0
  36. package/out/register/helper/async-action-register.d.ts.map +1 -0
  37. package/out/register/helper/async-action-register.js +35 -0
  38. package/out/register/helper/index.d.ts +1 -0
  39. package/out/register/helper/index.d.ts.map +1 -1
  40. package/out/register/helper/index.js +1 -0
  41. package/out/service/app-data-entity/app-data-entity.d.ts +3 -3
  42. package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
  43. package/out/service/app-data-entity/app-data-entity.js +3 -3
  44. package/out/service/service/async-action/async-action.service.d.ts +28 -0
  45. package/out/service/service/async-action/async-action.service.d.ts.map +1 -0
  46. package/out/service/service/async-action/async-action.service.js +31 -0
  47. package/out/service/service/index.d.ts +1 -0
  48. package/out/service/service/index.d.ts.map +1 -1
  49. package/out/service/service/index.js +1 -0
  50. package/out/types.d.ts +9 -1
  51. package/out/types.d.ts.map +1 -1
  52. package/package.json +3 -3
  53. package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +2 -1
  54. package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +17 -3
  55. package/src/controller/control/panel/panel/panel-item.controller.ts +2 -1
  56. package/src/controller/utils/data-file-util/data-file-util.ts +16 -27
  57. package/src/install.ts +7 -1
  58. package/src/interface/controller/event/argument/form-detail.event.ts +26 -2
  59. package/src/interface/controller/event/argument/index.ts +2 -0
  60. package/src/interface/controller/event/argument/panel-item.event.ts +25 -1
  61. package/src/interface/provider/i-async-action.provider.ts +29 -0
  62. package/src/interface/provider/index.ts +1 -0
  63. package/src/interface/service/service/i-async-action.service.ts +29 -0
  64. package/src/interface/service/service/index.ts +1 -0
  65. package/src/register/helper/async-action-register.ts +47 -0
  66. package/src/register/helper/index.ts +1 -0
  67. package/src/service/app-data-entity/app-data-entity.ts +3 -3
  68. package/src/service/service/async-action/async-action.service.ts +37 -0
  69. package/src/service/service/index.ts +1 -0
  70. package/src/types.ts +10 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-action.service.d.ts","sourceRoot":"","sources":["../../../../src/service/service/async-action/async-action.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,mBAAmB;IAC5D;;;;;;OAMG;IACG,KAAK,CACT,MAAM,GAAE,OAAY,GACnB,OAAO,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAK/C;;;;;;OAMG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAI1E"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 异步操作服务
3
+ * @author lxm
4
+ * @date 2023-11-15 10:52:06
5
+ * @export
6
+ * @class AsyncActionService
7
+ */
8
+ export class AsyncActionService {
9
+ /**
10
+ * 获取异步操作的集合
11
+ * @author lxm
12
+ * @date 2023-11-15 10:55:25
13
+ * @param {IParams} [params={}]
14
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
15
+ */
16
+ async fetch(params = {}) {
17
+ const res = await ibiz.net.post('/portal/asyncaction/all', params);
18
+ return res;
19
+ }
20
+ /**
21
+ * 获取单条异步操作
22
+ * @author lxm
23
+ * @date 2023-11-15 10:57:08
24
+ * @param {string} actionID
25
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
26
+ */
27
+ async get(actionID) {
28
+ const res = await ibiz.net.get(`/portal/asyncaction/${actionID}`);
29
+ return res;
30
+ }
31
+ }
@@ -6,4 +6,5 @@ export { WorkFlowService } from './work-flow/work-flow.service';
6
6
  export * from './control';
7
7
  export * from './authority';
8
8
  export { V7AuthService } from './auth/v7-auth.service';
9
+ export { AsyncActionService } from './async-action/async-action.service';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC"}
@@ -6,3 +6,4 @@ export { WorkFlowService } from './work-flow/work-flow.service';
6
6
  export * from './control';
7
7
  export * from './authority';
8
8
  export { V7AuthService } from './auth/v7-auth.service';
9
+ export { AsyncActionService } from './async-action/async-action.service';
package/out/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { I18n } from '@ibiz-template/core/src/interface';
2
2
  import { EngineFactory } from './engine';
3
3
  import { GlobalUtil } from './global';
4
- import { IMessageUtil, INotificationUtil, IOpenViewUtil, IModalUtil, IConfirmUtil, ILoadingUtil, IPluginFactory, IOverlayController, IGlobalConfig, IAppHubService, IAuthService } from './interface';
4
+ import { IMessageUtil, INotificationUtil, IOpenViewUtil, IModalUtil, IConfirmUtil, ILoadingUtil, IPluginFactory, IOverlayController, IGlobalConfig, IAppHubService, IAuthService, IAsyncActionService } from './interface';
5
5
  import { LogicSchedulerCenter } from './logic-scheduler';
6
6
  import { RegisterCenter } from './register/register-center';
7
7
  declare module '@ibiz-template/core' {
@@ -107,6 +107,14 @@ declare module '@ibiz-template/core' {
107
107
  * @type {IAuthService}
108
108
  */
109
109
  auth: IAuthService;
110
+ /**
111
+ * 异步操作服务
112
+ *
113
+ * @author chitanda
114
+ * @date 2022-07-20 10:07:33
115
+ * @type {IAuthService}
116
+ */
117
+ asyncAction: IAsyncActionService;
110
118
  /**
111
119
  * 引擎工厂
112
120
  * @author lxm
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,QAAQ,qBAAqB,CAAC;IACnC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"description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -29,7 +29,7 @@
29
29
  "author": "chitanda",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@ibiz-template/core": "^0.2.18-dev.1",
32
+ "@ibiz-template/core": "^0.3.0",
33
33
  "@ibiz/model-core": "^0.0.20",
34
34
  "@types/path-browserify": "^1.0.2",
35
35
  "@types/qs": "^6.9.10",
@@ -59,5 +59,5 @@
59
59
  "qx-util": "^0.4.8",
60
60
  "ramda": "^0.29.0"
61
61
  },
62
- "gitHead": "1177197c30972b535b6ae8071720d589c4db756b"
62
+ "gitHead": "048f2b8e3e692cbc26b79dcea56e8d867e3e9c9f"
63
63
  }
@@ -3,6 +3,7 @@ import { IDEFormDetail } from '@ibiz/model-core';
3
3
  import {
4
4
  IFormDetailController,
5
5
  IFormDetailContainerController,
6
+ FormDetailEventName,
6
7
  } from '../../../../../interface';
7
8
  import { calcLayoutHeightWidth, calcDynaClass } from '../../../../../model';
8
9
  import { verifyFormGroupLogic } from '../../../../../utils';
@@ -363,7 +364,7 @@ export class FormDetailController<T extends IDEFormDetail = IDEFormDetail>
363
364
  async onClick(event?: MouseEvent): Promise<void> {
364
365
  this.form.evt.emit('onFormDetailEvent', {
365
366
  formDetailName: this.model.id!,
366
- formDetailEventName: 'onClick',
367
+ formDetailEventName: FormDetailEventName.CLICK,
367
368
  event,
368
369
  });
369
370
  }
@@ -7,6 +7,7 @@ import { FormController } from '../../form/form.controller';
7
7
  import { FormDetailController } from '../form-detail/form-detail.controller';
8
8
  import { FormItemState } from './form-item.state';
9
9
  import {
10
+ FormDetailEventName,
10
11
  IEditorContainerController,
11
12
  IEditorController,
12
13
  IEditorProvider,
@@ -346,7 +347,7 @@ export class FormItemController
346
347
  await this.form.setDataValue(name, value);
347
348
  this.form.evt.emit('onFormDetailEvent', {
348
349
  formDetailName: this.model.id!,
349
- formDetailEventName: 'onChange',
350
+ formDetailEventName: FormDetailEventName.CHANGE,
350
351
  });
351
352
  }
352
353
 
@@ -384,7 +385,7 @@ export class FormItemController
384
385
  onFocus(event: MouseEvent): void {
385
386
  this.form.evt.emit('onFormDetailEvent', {
386
387
  formDetailName: this.model.id!,
387
- formDetailEventName: 'onFocus',
388
+ formDetailEventName: FormDetailEventName.FOCUS,
388
389
  event,
389
390
  });
390
391
  }
@@ -397,7 +398,20 @@ export class FormItemController
397
398
  onBlur(event: MouseEvent): void {
398
399
  this.form.evt.emit('onFormDetailEvent', {
399
400
  formDetailName: this.model.id!,
400
- formDetailEventName: 'onBlur',
401
+ formDetailEventName: FormDetailEventName.BLUR,
402
+ event,
403
+ });
404
+ }
405
+
406
+ /**
407
+ * 回车事件
408
+ * @author lxm
409
+ * @date 2023-10-11 05:03:26
410
+ */
411
+ onEnter(event: MouseEvent): void {
412
+ this.form.evt.emit('onFormDetailEvent', {
413
+ formDetailName: this.model.id!,
414
+ formDetailEventName: FormDetailEventName.ENTER,
401
415
  event,
402
416
  });
403
417
  }
@@ -5,6 +5,7 @@ import {
5
5
  IPanelController,
6
6
  IPanelDataContainerController,
7
7
  IPanelItemState,
8
+ PanelItemEventName,
8
9
  } from '../../../../interface';
9
10
  import { calcLayoutHeightWidth, calcDynaClass } from '../../../../model';
10
11
  import { verifyPanelGroupLogic } from '../../../../utils';
@@ -362,7 +363,7 @@ export class PanelItemController<T extends IPanelItem = IPanelItem>
362
363
  onClick(): void {
363
364
  this.panel.evt.emit('onPanelItemEvent', {
364
365
  panelItemName: this.model.id!,
365
- panelItemEventName: 'onClick',
366
+ panelItemEventName: PanelItemEventName.CLICK,
366
367
  });
367
368
  }
368
369
  }
@@ -6,10 +6,10 @@ import {
6
6
  import { IAppDataEntity } from '@ibiz/model-core';
7
7
 
8
8
  // 异步导入URL
9
- const asyncImportUrl = '/asyncimportdata2';
9
+ const asyncImportUrl = 'asyncimportdata2';
10
10
 
11
11
  // 标准导入url
12
- const importUrl = '/importdata2';
12
+ const importUrl = 'importdata2';
13
13
 
14
14
  // 导入结果类型
15
15
  export type ImportDataResult = {
@@ -33,33 +33,17 @@ export type IExportDataResult = {
33
33
  * @param {string} id
34
34
  * @return {*} {Promise<ImportDataResult>}
35
35
  */
36
- function listenAsyncAction(id: string): Promise<ImportDataResult> {
36
+ function listenAsyncAction(id: string): Promise<void> {
37
37
  return new Promise(resolve => {
38
38
  const callBack = (msg: IPortalMessage): void => {
39
39
  // 兼容接口返回类型与实际返回类型不一致
40
40
  const messageid = msg.messageid || (msg.data as IData).asyncacitonid;
41
- if (
42
- id === messageid &&
43
- (msg.data as IPortalAsyncAction).actionstate === 30
44
- ) {
45
- // 返回结果是字符串, 需解析
46
- try {
47
- const result = JSON.parse(
48
- (msg.data as IPortalAsyncAction).actionresult as string,
49
- );
50
- resolve(result as ImportDataResult);
51
- } catch (error) {
52
- throw new RuntimeError('解析数据发生错误');
53
- } finally {
54
- // 异步作业结束 取消订阅
55
- ibiz.mc.command.asyncAction.off(callBack);
56
- }
57
- } else if ((msg.data as IPortalAsyncAction).actionstate === 40) {
58
- resolve({
59
- total: 0,
60
- success: 0,
61
- message: (msg.data as IPortalAsyncAction).actionresult as string,
62
- });
41
+ if (id !== messageid) {
42
+ return;
43
+ }
44
+ const state = (msg.data as IPortalAsyncAction).actionstate;
45
+ if (state === 30 || state === 40) {
46
+ resolve();
63
47
  // 异步作业结束 取消订阅
64
48
  ibiz.mc.command.asyncAction.off(callBack);
65
49
  }
@@ -81,7 +65,7 @@ function listenAsyncAction(id: string): Promise<ImportDataResult> {
81
65
  export async function asyncImportData(
82
66
  file: File,
83
67
  appDataEntity: IAppDataEntity,
84
- ): Promise<ImportDataResult> {
68
+ ): Promise<void> {
85
69
  const data = new FormData();
86
70
  data.append('file', file);
87
71
  const url = `${appDataEntity.codeName2!.toLowerCase()}/${asyncImportUrl}`;
@@ -90,7 +74,12 @@ export async function asyncImportData(
90
74
  data,
91
75
  headers: { 'Content-Type': 'multipart/form-data' },
92
76
  });
93
- return listenAsyncAction(res.data.asyncacitonid);
77
+ await listenAsyncAction(res.data.asyncacitonid);
78
+ // 模拟表单通知 刷新表格
79
+ ibiz.mc.command.send(
80
+ { srfdecodename: appDataEntity.codeName },
81
+ 'OBJECTCREATED',
82
+ );
94
83
  }
95
84
 
96
85
  /**
package/src/install.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { GlobalConfig } from './config/global-config';
2
2
  import { RegisterCenter } from './register/register-center';
3
3
  import { installCommand } from './command';
4
- import { presetAppCounterProvider, V7AuthService } from './service';
4
+ import {
5
+ AsyncActionService,
6
+ presetAppCounterProvider,
7
+ V7AuthService,
8
+ } from './service';
5
9
  import { AppHub } from './app-hub';
6
10
  import { EngineFactory } from './engine';
7
11
  import { GlobalUtil } from './global';
@@ -27,6 +31,8 @@ export function install(): void {
27
31
  ibiz.config = new GlobalConfig();
28
32
  // 挂载认证服务
29
33
  ibiz.auth = new V7AuthService();
34
+ // 挂载异步操作服务
35
+ ibiz.asyncAction = new AsyncActionService();
30
36
  // 挂载引擎工厂
31
37
  ibiz.engine = new EngineFactory();
32
38
  // 安装默认指令
@@ -1,5 +1,29 @@
1
1
  import { EventBase } from './base.event';
2
2
 
3
+ /* eslint-disable no-shadow */
4
+ export enum FormDetailEventName {
5
+ /**
6
+ * 点击
7
+ */
8
+ CLICK = 'onClick',
9
+ /**
10
+ * 聚焦
11
+ */
12
+ FOCUS = 'onFocus',
13
+ /**
14
+ * 失焦
15
+ */
16
+ BLUR = 'onBlur',
17
+ /**
18
+ * 值变更
19
+ */
20
+ CHANGE = 'onChange',
21
+ /**
22
+ * 回车
23
+ */
24
+ ENTER = 'onEnter',
25
+ }
26
+
3
27
  /**
4
28
  * 表单成员事件
5
29
  * @author lxm
@@ -21,7 +45,7 @@ export interface FormDetailEvent extends EventBase {
21
45
  * 触发的表单成员事件的名称
22
46
  * @author lxm
23
47
  * @date 2023-07-26 11:00:37
24
- * @type {string}
48
+ * @type {FormDetailEventName}
25
49
  */
26
- formDetailEventName: string;
50
+ formDetailEventName: FormDetailEventName;
27
51
  }
@@ -9,3 +9,5 @@ export type { NavViewChangeEvent } from './nav-view-change.event';
9
9
  export type { RowEditChangeEvent } from './row-edit-change.event';
10
10
  export type { PanelItemEvent } from './panel-item.event';
11
11
  export type { FormDetailEvent } from './form-detail.event';
12
+ export { FormDetailEventName } from './form-detail.event';
13
+ export { PanelItemEventName } from './panel-item.event';
@@ -1,5 +1,29 @@
1
1
  import { EventBase } from './base.event';
2
2
 
3
+ /* eslint-disable no-shadow */
4
+ export enum PanelItemEventName {
5
+ /**
6
+ * 点击
7
+ */
8
+ CLICK = 'onClick',
9
+ /**
10
+ * 聚焦
11
+ */
12
+ FOCUS = 'onFocus',
13
+ /**
14
+ * 失焦
15
+ */
16
+ BLUR = 'onBlur',
17
+ /**
18
+ * 值变更
19
+ */
20
+ CHANGE = 'onChange',
21
+ /**
22
+ * 回车
23
+ */
24
+ ENTER = 'onEnter',
25
+ }
26
+
3
27
  /**
4
28
  * 面板成员事件
5
29
  * @author lxm
@@ -23,5 +47,5 @@ export interface PanelItemEvent extends EventBase {
23
47
  * @date 2023-07-26 11:00:37
24
48
  * @type {string}
25
49
  */
26
- panelItemEventName: string;
50
+ panelItemEventName: PanelItemEventName;
27
51
  }
@@ -0,0 +1,29 @@
1
+ import { IPortalAsyncAction } from '@ibiz-template/core';
2
+
3
+ /**
4
+ * 异步操作适配器的接口
5
+ *
6
+ * @author lxm
7
+ * @date 2022-09-19 19:09:10
8
+ * @export
9
+ * @interface IAsyncActionProvider
10
+ */
11
+ export interface IAsyncActionProvider {
12
+ /**
13
+ * 绘制组件
14
+ * @author lxm
15
+ * @date 2022-09-20 10:09:50
16
+ * @type {unknown}
17
+ */
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ component: any;
20
+
21
+ /**
22
+ * 点击事件
23
+ * @author lxm
24
+ * @date 2023-11-14 09:30:39
25
+ * @param {IPortalAsyncAction} asyncAction
26
+ * @param {MouseEvent} event
27
+ */
28
+ onClick(asyncAction: IPortalAsyncAction, event: MouseEvent): void;
29
+ }
@@ -10,3 +10,4 @@ export type * from './i-editor.provider';
10
10
  export type * from './i-portlet.provider';
11
11
  export type { IAppCounterProvider } from './i-app-counter.provider';
12
12
  export type { IUILogicNodeProvider } from './i-ui-login-node.provider';
13
+ export type { IAsyncActionProvider } from './i-async-action.provider';
@@ -0,0 +1,29 @@
1
+ import { IHttpResponse, IPortalAsyncAction } from '@ibiz-template/core';
2
+
3
+ /**
4
+ * 异步操作服务
5
+ *
6
+ * @author chitanda
7
+ * @date 2023-08-17 16:08:08
8
+ * @export
9
+ * @interface IAuthService
10
+ */
11
+ export interface IAsyncActionService {
12
+ /**
13
+ * 获取异步操作的集合
14
+ * @author lxm
15
+ * @date 2023-11-15 10:55:25
16
+ * @param {IParams} [params={}]
17
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
18
+ */
19
+ fetch(params?: IParams): Promise<IHttpResponse<IPortalAsyncAction[]>>;
20
+
21
+ /**
22
+ * 获取单条异步操作
23
+ * @author lxm
24
+ * @date 2023-11-15 10:57:08
25
+ * @param {string} actionID
26
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
27
+ */
28
+ get(actionID: string): Promise<IHttpResponse<IPortalAsyncAction[]>>;
29
+ }
@@ -4,3 +4,4 @@ export type { IAppDEService } from './i-app-de.service';
4
4
  export type { IAuthService } from './i-auth.service';
5
5
  export type { IFileService } from './i-file.service';
6
6
  export type { IWorkFlowService } from './i-wf.service';
7
+ export type { IAsyncActionService } from './i-async-action.service';
@@ -0,0 +1,47 @@
1
+ import { RuntimeError } from '@ibiz-template/core';
2
+ import { IAsyncActionProvider } from '../../interface';
3
+
4
+ /** 界面行为适配器前缀 */
5
+ export const ASYNC_ACTION_PROVIDER_PREFIX = 'ASYNC_ACTION';
6
+
7
+ /**
8
+ * 注册界面行为适配器
9
+ * @author lxm
10
+ * @date 2023-05-06 09:14:16
11
+ * @export
12
+ * @param {string} key
13
+ * @param {() => IAsyncActionProvider} callback 生成界面行为适配器的回调
14
+ */
15
+ export function registerAsyncActionProvider(
16
+ key: string,
17
+ callback: () => IAsyncActionProvider,
18
+ ): void {
19
+ ibiz.register.register(`${ASYNC_ACTION_PROVIDER_PREFIX}_${key}`, callback);
20
+ }
21
+
22
+ function getProvider(key: string): IAsyncActionProvider | undefined {
23
+ return ibiz.register.get(
24
+ `${ASYNC_ACTION_PROVIDER_PREFIX}_${key}`,
25
+ ) as IAsyncActionProvider;
26
+ }
27
+
28
+ /**
29
+ * 获取界面行为适配器
30
+ * @author lxm
31
+ * @date 2023-05-06 09:29:23
32
+ * @export
33
+ * @param {IAppView} model
34
+ * @return {*} {Promise<IAsyncActionProvider>}
35
+ */
36
+ export function getAsyncActionProvider(
37
+ actiontype: string,
38
+ ): IAsyncActionProvider {
39
+ const provider: IAsyncActionProvider | undefined = getProvider(actiontype);
40
+
41
+ // 找异步操作类型
42
+ if (!provider) {
43
+ throw new RuntimeError(`找不异步操作类型${actiontype}对应的适配器`);
44
+ } else {
45
+ return provider;
46
+ }
47
+ }
@@ -8,3 +8,4 @@ export * from './portlet-register';
8
8
  export * from './ui-action-register';
9
9
  export * from './ui-logic-node-register';
10
10
  export * from './view-register';
11
+ export * from './async-action-register';
@@ -46,11 +46,11 @@ export class AppDataEntity implements IDataEntity {
46
46
  * Creates an instance of AppDataEntity.
47
47
  *
48
48
  * @author chitanda
49
- * @date 2022-10-11 21:10:21
49
+ * @date 2023-11-16 15:11:08
50
50
  * @param {IAppDataEntity} entity
51
- * @param {(IData | AppDataEntity)} data
51
+ * @param {(IData | AppDataEntity)} [data={}]
52
52
  */
53
- constructor(entity: IAppDataEntity, data: IData | AppDataEntity) {
53
+ constructor(entity: IAppDataEntity, data: IData | AppDataEntity = {}) {
54
54
  Object.defineProperty(this, '_entity', {
55
55
  enumerable: false,
56
56
  configurable: true,
@@ -0,0 +1,37 @@
1
+ import { IHttpResponse, IPortalAsyncAction } from '@ibiz-template/core';
2
+ import { IAsyncActionService } from '../../../interface';
3
+
4
+ /**
5
+ * 异步操作服务
6
+ * @author lxm
7
+ * @date 2023-11-15 10:52:06
8
+ * @export
9
+ * @class AsyncActionService
10
+ */
11
+ export class AsyncActionService implements IAsyncActionService {
12
+ /**
13
+ * 获取异步操作的集合
14
+ * @author lxm
15
+ * @date 2023-11-15 10:55:25
16
+ * @param {IParams} [params={}]
17
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
18
+ */
19
+ async fetch(
20
+ params: IParams = {},
21
+ ): Promise<IHttpResponse<IPortalAsyncAction[]>> {
22
+ const res = await ibiz.net.post('/portal/asyncaction/all', params);
23
+ return res as IHttpResponse<IPortalAsyncAction[]>;
24
+ }
25
+
26
+ /**
27
+ * 获取单条异步操作
28
+ * @author lxm
29
+ * @date 2023-11-15 10:57:08
30
+ * @param {string} actionID
31
+ * @return {*} {Promise<IHttpResponse<IPortalAsyncAction[]>>}
32
+ */
33
+ async get(actionID: string): Promise<IHttpResponse<IPortalAsyncAction[]>> {
34
+ const res = await ibiz.net.get(`/portal/asyncaction/${actionID}`);
35
+ return res as IHttpResponse<IPortalAsyncAction[]>;
36
+ }
37
+ }
@@ -6,3 +6,4 @@ export { WorkFlowService } from './work-flow/work-flow.service';
6
6
  export * from './control';
7
7
  export * from './authority';
8
8
  export { V7AuthService } from './auth/v7-auth.service';
9
+ export { AsyncActionService } from './async-action/async-action.service';
package/src/types.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  IGlobalConfig,
14
14
  IAppHubService,
15
15
  IAuthService,
16
+ IAsyncActionService,
16
17
  } from './interface';
17
18
  import { LogicSchedulerCenter } from './logic-scheduler';
18
19
  import { RegisterCenter } from './register/register-center';
@@ -132,6 +133,15 @@ declare module '@ibiz-template/core' {
132
133
  */
133
134
  auth: IAuthService;
134
135
 
136
+ /**
137
+ * 异步操作服务
138
+ *
139
+ * @author chitanda
140
+ * @date 2022-07-20 10:07:33
141
+ * @type {IAuthService}
142
+ */
143
+ asyncAction: IAsyncActionService;
144
+
135
145
  /**
136
146
  * 引擎工厂
137
147
  * @author lxm