@ibiz-template/runtime 0.1.7 → 0.1.8

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 (108) hide show
  1. package/dist/index.esm.js +208 -67
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/constant/sys-uiaction-tag.d.ts +8 -0
  5. package/out/constant/sys-uiaction-tag.d.ts.map +1 -1
  6. package/out/constant/sys-uiaction-tag.js +8 -0
  7. package/out/controller/common/control/md-control.controller.d.ts +3 -1
  8. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  9. package/out/controller/common/control/md-control.controller.js +31 -13
  10. package/out/engine/md-view.engine.d.ts.map +1 -1
  11. package/out/engine/md-view.engine.js +10 -4
  12. package/out/install.js +2 -2
  13. package/out/interface/controller/common/i-icon/i-icon.d.ts +7 -0
  14. package/out/interface/controller/common/i-icon/i-icon.d.ts.map +1 -1
  15. package/out/interface/controller/controller/control/i-grid.controller.d.ts +11 -4
  16. package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
  17. package/out/interface/controller/controller/control/i-md-control.controller.d.ts +7 -0
  18. package/out/interface/controller/controller/control/i-md-control.controller.d.ts.map +1 -1
  19. package/out/interface/controller/controller/control/i-tree.controller.d.ts +7 -0
  20. package/out/interface/controller/controller/control/i-tree.controller.d.ts.map +1 -1
  21. package/out/interface/controller/event/argument/index.d.ts +1 -0
  22. package/out/interface/controller/event/argument/index.d.ts.map +1 -1
  23. package/out/interface/controller/event/argument/row-edit-change.event.d.ts +20 -0
  24. package/out/interface/controller/event/argument/row-edit-change.event.d.ts.map +1 -0
  25. package/out/interface/controller/event/argument/row-edit-change.event.js +1 -0
  26. package/out/interface/controller/event/control/i-grid.event.d.ts +13 -1
  27. package/out/interface/controller/event/control/i-grid.event.d.ts.map +1 -1
  28. package/out/interface/controller/event/control/i-tree.event.d.ts +19 -0
  29. package/out/interface/controller/event/control/i-tree.event.d.ts.map +1 -1
  30. package/out/interface/controller/state/control/i-grid.state.d.ts +8 -0
  31. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  32. package/out/interface/controller/state/control/i-tree.state.d.ts +16 -1
  33. package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
  34. package/out/interface/controller/work-flow/wf-link.d.ts +9 -0
  35. package/out/interface/controller/work-flow/wf-link.d.ts.map +1 -1
  36. package/out/interface/service/service/i-auth.service.d.ts +29 -0
  37. package/out/interface/service/service/i-auth.service.d.ts.map +1 -0
  38. package/out/interface/service/service/i-auth.service.js +1 -0
  39. package/out/interface/service/service/index.d.ts +5 -4
  40. package/out/interface/service/service/index.d.ts.map +1 -1
  41. package/out/interface/service/service/index.js +1 -4
  42. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +9 -0
  43. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
  44. package/out/register/helper/editor-register.d.ts.map +1 -1
  45. package/out/register/helper/editor-register.js +12 -1
  46. package/out/service/dto/method.dto.d.ts.map +1 -1
  47. package/out/service/dto/method.dto.js +8 -0
  48. package/out/service/service/auth/v7-auth.service.d.ts +14 -0
  49. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -0
  50. package/out/service/service/auth/v7-auth.service.js +47 -0
  51. package/out/service/service/index.d.ts +1 -1
  52. package/out/service/service/index.d.ts.map +1 -1
  53. package/out/service/service/index.js +1 -1
  54. package/out/service/vo/control.vo.d.ts +8 -0
  55. package/out/service/vo/control.vo.d.ts.map +1 -1
  56. package/out/service/vo/control.vo.js +16 -1
  57. package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
  58. package/out/service/vo/tree-node-data/tree-code-list-node-data.js +1 -0
  59. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +21 -2
  60. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  61. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +48 -0
  62. package/out/service/vo/tree-node-data/tree-node-data.d.ts +12 -1
  63. package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
  64. package/out/service/vo/tree-node-data/tree-node-data.js +21 -2
  65. package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
  66. package/out/service/vo/tree-node-data/tree-static-node-data.js +1 -0
  67. package/out/types.d.ts +3 -4
  68. package/out/types.d.ts.map +1 -1
  69. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  70. package/out/utils/open-redirect-view/open-redirect-view.js +17 -17
  71. package/out/utils/script/script-function.d.ts.map +1 -1
  72. package/out/utils/script/script-function.js +4 -1
  73. package/package.json +3 -3
  74. package/src/constant/sys-uiaction-tag.ts +8 -0
  75. package/src/controller/common/control/md-control.controller.ts +37 -14
  76. package/src/engine/md-view.engine.ts +13 -4
  77. package/src/install.ts +2 -2
  78. package/src/interface/controller/common/i-icon/i-icon.ts +8 -0
  79. package/src/interface/controller/controller/control/i-grid.controller.ts +12 -4
  80. package/src/interface/controller/controller/control/i-md-control.controller.ts +9 -1
  81. package/src/interface/controller/controller/control/i-tree.controller.ts +8 -0
  82. package/src/interface/controller/event/argument/index.ts +1 -0
  83. package/src/interface/controller/event/argument/row-edit-change.event.ts +20 -0
  84. package/src/interface/controller/event/control/i-grid.event.ts +14 -1
  85. package/src/interface/controller/event/control/i-tree.event.ts +14 -0
  86. package/src/interface/controller/state/control/i-grid.state.ts +9 -0
  87. package/src/interface/controller/state/control/i-tree.state.ts +19 -1
  88. package/src/interface/controller/work-flow/wf-link.ts +10 -0
  89. package/src/interface/service/service/i-auth.service.ts +29 -0
  90. package/src/interface/service/service/index.ts +5 -4
  91. package/src/interface/util/i-open-view-util/i-open-view-util.ts +10 -0
  92. package/src/register/helper/editor-register.ts +17 -1
  93. package/src/service/dto/method.dto.ts +8 -0
  94. package/src/service/service/auth/v7-auth.service.ts +49 -0
  95. package/src/service/service/index.ts +1 -1
  96. package/src/service/vo/control.vo.ts +17 -1
  97. package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +2 -0
  98. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +60 -2
  99. package/src/service/vo/tree-node-data/tree-node-data.ts +27 -3
  100. package/src/service/vo/tree-node-data/tree-static-node-data.ts +2 -0
  101. package/src/types.ts +3 -3
  102. package/src/ui-action/provider/front-ui-action-provider.ts +1 -1
  103. package/src/utils/open-redirect-view/open-redirect-view.ts +20 -19
  104. package/src/utils/script/script-function.ts +4 -1
  105. package/out/service/service/auth/auth.service.d.ts +0 -30
  106. package/out/service/service/auth/auth.service.d.ts.map +0 -1
  107. package/out/service/service/auth/auth.service.js +0 -37
  108. package/src/service/service/auth/auth.service.ts +0 -44
@@ -142,11 +142,11 @@ export class MDViewEngine extends ViewEngineBase {
142
142
  return null;
143
143
  }
144
144
  if (key === SysUIActionTag.EDIT || key === SysUIActionTag.VIEW) {
145
- this.openData(args!);
145
+ await this.openData(args!);
146
146
  return null;
147
147
  }
148
148
  if (key === SysUIActionTag.NEW) {
149
- this.newData(args!);
149
+ await this.newData(args!);
150
150
  return null;
151
151
  }
152
152
  if (key === SysUIActionTag.REMOVE) {
@@ -300,10 +300,19 @@ export class MDViewEngine extends ViewEngineBase {
300
300
  // 有搜索表单的整合相关参数
301
301
  if (this.searchForm) {
302
302
  const addParams = this.searchForm.getData()[0];
303
- Object.assign(params, addParams);
303
+ const filteredParams = Object.entries(addParams).reduce(
304
+ (result: IData, [key, value]) => {
305
+ if (value !== null && value !== undefined && value !== '') {
306
+ result[key] = value;
307
+ }
308
+ return result;
309
+ },
310
+ {},
311
+ );
312
+ Object.assign(params, filteredParams);
304
313
  }
305
314
  // 有搜索栏的整合相关参数
306
- if (this.searchBar) {
315
+ if (this.searchBar && this.searchBar.state.query) {
307
316
  const addParams = {
308
317
  query: this.searchBar.state.query,
309
318
  };
package/src/install.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { GlobalConfig } from './config/global-config';
2
2
  import { RegisterCenter } from './register/register-center';
3
3
  import { installCommand } from './command';
4
- import { AuthService } from './service';
4
+ import { V7AuthService } from './service';
5
5
  import { AppHub } from './app-hub';
6
6
  import { EngineFactory } from './engine';
7
7
  import { GlobalUtil } from './global';
@@ -26,7 +26,7 @@ export function install(): void {
26
26
  // 初始化全局配置
27
27
  ibiz.config = new GlobalConfig();
28
28
  // 挂载认证服务
29
- ibiz.auth = new AuthService();
29
+ ibiz.auth = new V7AuthService();
30
30
  // 挂载引擎工厂
31
31
  ibiz.engine = new EngineFactory();
32
32
  // 安装默认指令
@@ -21,4 +21,12 @@ export interface IIcon {
21
21
  * @type {string}
22
22
  */
23
23
  imagePath?: string;
24
+
25
+ /**
26
+ * html字符串
27
+ * @author lxm
28
+ * @date 2023-08-15 02:14:26
29
+ * @type {string}
30
+ */
31
+ htmlStr?: string;
24
32
  }
@@ -24,7 +24,7 @@ export interface IGridController
24
24
  newRow(): Promise<void>;
25
25
 
26
26
  /**
27
- * 保存
27
+ * 保存单条数据
28
28
  *
29
29
  * @author zk
30
30
  * @date 2023-07-31 02:07:52
@@ -33,13 +33,21 @@ export interface IGridController
33
33
  save(data: ControlVO): Promise<void>;
34
34
 
35
35
  /**
36
- * 切换行编辑状态
36
+ * 保存表格所有数据
37
37
  *
38
38
  * @author zk
39
- * @date 2023-07-31 02:07:26
39
+ * @date 2023-07-31 02:07:52
40
40
  * @memberof IGridController
41
41
  */
42
- toggleRowEdit(row?: IData): void;
42
+ saveAll(): Promise<void>;
43
+
44
+ /**
45
+ * 切换表格的行编辑开启关闭状态
46
+ * @author lxm
47
+ * @date 2023-08-16 10:18:14
48
+ * @param {IData} [rowData] 行数据
49
+ */
50
+ toggleRowEdit(): void;
43
51
 
44
52
  /**
45
53
  * 数据导出
@@ -20,7 +20,15 @@ export interface MDCtrlLoadParams extends IDataAbilityParams {
20
20
  isLoadMore?: boolean;
21
21
  }
22
22
 
23
- export interface MDCtrlRemoveParams extends IDataAbilityParams {}
23
+ export interface MDCtrlRemoveParams extends IDataAbilityParams {
24
+ /**
25
+ * 是否静默删除
26
+ * @author lxm
27
+ * @date 2023-08-17 06:04:23
28
+ * @type {boolean}
29
+ */
30
+ silent?: boolean;
31
+ }
24
32
 
25
33
  /**
26
34
  * 多数据部件控制器
@@ -44,4 +44,12 @@ export interface ITreeController
44
44
  nodeData: ITreeNodeData,
45
45
  event: MouseEvent,
46
46
  ): Promise<void>;
47
+
48
+ /**
49
+ * 刷新父节点数据
50
+ * @author lxm
51
+ * @date 2023-08-18 01:49:59
52
+ * @param {ITreeNodeData} parentNode
53
+ */
54
+ refreshParent(parentData: ITreeNodeData | IData): void;
47
55
  }
@@ -6,3 +6,4 @@ export { CloseViewEvent } from './close-view.event';
6
6
  export { UIActionEvent } from './uiaction.event';
7
7
  export { ControlTriggerEvent } from './control-trigger.event';
8
8
  export { NavViewChangeEvent } from './nav-view-change.event';
9
+ export { RowEditChangeEvent } from './row-edit-change.event';
@@ -0,0 +1,20 @@
1
+ import { IGridRowState } from '../../state';
2
+ import { EventBase } from './base.event';
3
+
4
+ /**
5
+ * 行编辑切换事件
6
+ * @author lxm
7
+ * @date 2023-03-26 02:07:11
8
+ * @export
9
+ * @interface RowEditChangeEvent
10
+ * @extends {EventBase}
11
+ */
12
+ export interface RowEditChangeEvent extends EventBase {
13
+ /**
14
+ * 行状态对象
15
+ * @author lxm
16
+ * @date 2023-08-17 06:58:15
17
+ * @type {IGridRowState}
18
+ */
19
+ row: IGridRowState;
20
+ }
@@ -1,4 +1,5 @@
1
- import { EventBase } from '../..';
1
+ import { PartialWithObject } from '@ibiz-template/core';
2
+ import { EventBase, RowEditChangeEvent } from '../..';
2
3
  import { IMDControlEvent } from './i-md-control.event';
3
4
 
4
5
  /**
@@ -21,4 +22,16 @@ export interface IGridEvent extends IMDControlEvent {
21
22
  event: EventBase;
22
23
  emitArgs: { data: IData[] };
23
24
  };
25
+
26
+ /**
27
+ * 表格行编辑切换事件
28
+ * @author lxm
29
+ * @date 2023-03-26 06:15:06
30
+ * @param {emitArgs} undefined
31
+ * @return {*} {Promise<void>}
32
+ */
33
+ onRowEditChange: {
34
+ event: RowEditChangeEvent;
35
+ emitArgs: PartialWithObject<RowEditChangeEvent, EventBase>;
36
+ };
24
37
  }
@@ -21,4 +21,18 @@ export interface ITreeEvent extends IMDControlEvent {
21
21
  event: EventBase & { nodeData: ITreeNodeData };
22
22
  emitArgs: { data: IData[]; nodeData: ITreeNodeData };
23
23
  };
24
+
25
+ /**
26
+ * 父节点刷新结束之后事件
27
+ * @author lxm
28
+ * @date 2023-08-18 02:18:24
29
+ * @type {({
30
+ * event: EventBase & { children: ITreeNodeData[] };
31
+ * emitArgs: { children: ITreeNodeData[] };
32
+ * })}
33
+ */
34
+ onAfterRefreshParent: {
35
+ event: EventBase & { parentNode: ITreeNodeData; children: ITreeNodeData[] };
36
+ emitArgs: { parentNode: ITreeNodeData; children: ITreeNodeData[] };
37
+ };
24
38
  }
@@ -36,6 +36,14 @@ export interface IGridState extends IMDControlState {
36
36
  * @type {IData}
37
37
  */
38
38
  remoteAggResult?: IData;
39
+
40
+ /**
41
+ * 开启表格行编辑
42
+ * @author lxm
43
+ * @date 2023-08-17 02:38:18
44
+ * @type {boolean}
45
+ */
46
+ rowEditOpen: boolean;
39
47
  }
40
48
 
41
49
  export interface IGridRowState {
@@ -75,6 +83,7 @@ export interface IGridRowState {
75
83
  editColStates: {
76
84
  [p: string]: {
77
85
  disabled: boolean;
86
+ readonly: boolean;
78
87
  editable: boolean;
79
88
  required: boolean;
80
89
  };
@@ -1,4 +1,4 @@
1
- import { IButtonContainerState } from '../../common';
1
+ import { IButtonContainerState, IIcon } from '../../common';
2
2
  import { IMDControlState } from './i-md-control.state';
3
3
 
4
4
  /**
@@ -10,6 +10,8 @@ import { IMDControlState } from './i-md-control.state';
10
10
  * @extends {IMDControlState}
11
11
  */
12
12
  export interface ITreeState extends IMDControlState {
13
+ items: ITreeNodeData[];
14
+
13
15
  /**
14
16
  * 树的根节点
15
17
  *
@@ -152,5 +154,21 @@ export interface ITreeNodeData {
152
154
  */
153
155
  srfmajortext?: string;
154
156
 
157
+ /**
158
+ * 图标
159
+ * @author lxm
160
+ * @date 2023-08-15 02:02:49
161
+ * @type {IIcon}
162
+ */
163
+ icon?: IIcon;
164
+
165
+ /**
166
+ * 节点文本的html显示
167
+ * @author lxm
168
+ * @date 2023-08-15 02:15:09
169
+ * @type {string}
170
+ */
171
+ textHtml?: string;
172
+
155
173
  // todo 其他界面绘制相关属性
156
174
  }
@@ -64,4 +64,14 @@ export interface WFLink {
64
64
  * @type {string}
65
65
  */
66
66
  type?: 'reassign' | 'addstepbefore' | 'sendback' | 'sendcopy' | string;
67
+
68
+ /**
69
+ * link按钮标识
70
+ *
71
+ * @author zk
72
+ * @date 2023-08-17 12:08:32
73
+ * @type {string}
74
+ * @memberof WFLink
75
+ */
76
+ id: string;
67
77
  }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * 认证服务
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-08-17 16:08:08
6
+ * @export
7
+ * @interface IAuthService
8
+ */
9
+ export interface IAuthService {
10
+ /**
11
+ * 登录
12
+ *
13
+ * @author chitanda
14
+ * @date 2023-08-17 16:08:23
15
+ * @param {string} loginName
16
+ * @param {string} password
17
+ * @return {*} {Promise<boolean>}
18
+ */
19
+ login(loginName: string, password: string): Promise<boolean>;
20
+
21
+ /**
22
+ * 登出
23
+ *
24
+ * @author chitanda
25
+ * @date 2023-08-17 16:08:33
26
+ * @return {*} {Promise<boolean>}
27
+ */
28
+ logout(): Promise<boolean>;
29
+ }
@@ -1,4 +1,5 @@
1
- export * from './i-app-de-authority.service';
2
- export * from './i-app-de.service';
3
- export * from './i-file.service';
4
- export * from './i-wf.service';
1
+ export type { IAppDeAuthorityService } from './i-app-de-authority.service';
2
+ export type { IAppDEService } from './i-app-de.service';
3
+ export type { IAuthService } from './i-auth.service';
4
+ export type { IFileService } from './i-file.service';
5
+ export type { IWorkFlowService } from './i-wf.service';
@@ -10,6 +10,16 @@ import { IModalData, IViewConfig } from '../../common';
10
10
  * @interface IOpenViewUtil
11
11
  */
12
12
  export interface IOpenViewUtil {
13
+ /**
14
+ * 直接路径打开视图
15
+ *
16
+ * @author chitanda
17
+ * @date 2023-08-18 11:08:33
18
+ * @param {string} path
19
+ * @return {*} {Promise<IModalData>}
20
+ */
21
+ push(path: string): Promise<IModalData>;
22
+
13
23
  /**
14
24
  * 打开顶级视图(一般为路由打开)
15
25
  *
@@ -37,7 +37,8 @@ export async function getEditorProvider(
37
37
  model: IEditor,
38
38
  ): Promise<IEditorProvider | undefined> {
39
39
  let provider: IEditorProvider | undefined;
40
- const { editorType, editorStyle } = model as Required<IEditor>;
40
+ const { editorType, editorStyle, predefinedType } =
41
+ model as Required<IEditor>;
41
42
 
42
43
  // 再找编辑器类型和编辑器样式
43
44
  if (editorStyle && editorStyle !== 'DEFAULT') {
@@ -51,6 +52,21 @@ export async function getEditorProvider(
51
52
  }
52
53
  }
53
54
 
55
+ // 编辑器预置类型
56
+ if (predefinedType) {
57
+ let key = `${predefinedType}_${editorType}`;
58
+ if (editorStyle && editorStyle !== 'DEFAULT') {
59
+ key += `_${editorStyle}`;
60
+ }
61
+ provider = getProvider(key);
62
+ if (!provider) {
63
+ ibiz.log.error(
64
+ `找不到编辑器类型:[${editorType}]的预置类型:[${predefinedType}]对应的适配器`,
65
+ model,
66
+ );
67
+ }
68
+ }
69
+
54
70
  // 找编辑器类型
55
71
  if (!provider) {
56
72
  provider = getProvider(editorType);
@@ -60,6 +60,10 @@ export class MethodDto {
60
60
  break;
61
61
  }
62
62
  case 'DTOS': {
63
+ // 没有实体id的不处理
64
+ if (!field.refAppDataEntityId) {
65
+ break;
66
+ }
63
67
  const dto = await this.getFieldDto(field);
64
68
  const service = await this.app!.deService.getService(
65
69
  field.refAppDataEntityId!,
@@ -102,6 +106,10 @@ export class MethodDto {
102
106
  const all = this.fields
103
107
  .filter(field => field.type === 'DTOS')
104
108
  .map(async field => {
109
+ // 没有实体id的不处理
110
+ if (!field.refAppDataEntityId) {
111
+ return;
112
+ }
105
113
  const key = field.codeName!.toLowerCase();
106
114
  const dto = await this.getFieldDto(field);
107
115
  const items: IData[] = datum[key];
@@ -0,0 +1,49 @@
1
+ import { CoreConst, HttpError } from '@ibiz-template/core';
2
+ import { clearCookie, setCookie } from 'qx-util';
3
+ import { IAuthService } from '../../../interface';
4
+
5
+ /**
6
+ * 认证服务
7
+ *
8
+ * @author chitanda
9
+ * @date 2022-07-19 18:07:51
10
+ * @export
11
+ * @class AuthService
12
+ */
13
+ export class V7AuthService implements IAuthService {
14
+ async login(loginname: string, password: string): Promise<boolean> {
15
+ // eslint-disable-next-line no-useless-catch
16
+ try {
17
+ const res = await ibiz.net.post('/v7/login', { loginname, password });
18
+ const { data } = res;
19
+ if (data && data.token) {
20
+ setCookie(CoreConst.TOKEN, data.token, 0, true);
21
+ const expiredDate =
22
+ new Date().getTime() + (data.expirein || 7199) * 1000;
23
+ setCookie(CoreConst.TOKEN_EXPIRES, `${expiredDate}`, 0, true);
24
+ }
25
+ return true;
26
+ } catch (err: unknown) {
27
+ ibiz.notification.error({
28
+ title: '登录失败',
29
+ desc: (err as HttpError).message || '',
30
+ });
31
+ }
32
+ return false;
33
+ }
34
+
35
+ async logout(): Promise<boolean> {
36
+ try {
37
+ await ibiz.net.get('/v7/logout');
38
+ clearCookie(CoreConst.TOKEN);
39
+ clearCookie(CoreConst.TOKEN_EXPIRES);
40
+ return true;
41
+ } catch (err: unknown) {
42
+ ibiz.notification.error({
43
+ title: '登出失败',
44
+ desc: (err as HttpError).message || '',
45
+ });
46
+ }
47
+ return false;
48
+ }
49
+ }
@@ -4,4 +4,4 @@ export { DEService } from './entity/de.service';
4
4
  export { WorkFlowService } from './work-flow/work-flow.service';
5
5
  export * from './control';
6
6
  export * from './authority';
7
- export { AuthService } from './auth/auth.service';
7
+ export { V7AuthService } from './auth/v7-auth.service';
@@ -1,4 +1,4 @@
1
- import { isNil } from 'ramda';
1
+ import { clone, isNil } from 'ramda';
2
2
  import { Srfuf } from '../constant';
3
3
  import { UIMapField } from './ui-map-field';
4
4
 
@@ -220,4 +220,20 @@ export class ControlVO {
220
220
  setOrigin(data: IData | ControlVO): void {
221
221
  this.$origin = data instanceof ControlVO ? data.getOrigin() : data;
222
222
  }
223
+
224
+ /**
225
+ * 克隆新的vo数据
226
+ *
227
+ * @author lxm
228
+ * @date 2023-08-16 11:08:29
229
+ * @return {*} {ControlVO}
230
+ */
231
+ clone(): ControlVO {
232
+ const cloneOrigin = clone(this.$origin);
233
+ const newVal = new ControlVO(cloneOrigin, this.$dataUIMap);
234
+ Object.keys(this).forEach(key => {
235
+ newVal[key] = this[key];
236
+ });
237
+ return newVal;
238
+ }
223
239
  }
@@ -54,5 +54,7 @@ export class TreeCodeListNodeData
54
54
 
55
55
  this.srfkey = this.value;
56
56
  this.srfmajortext = this.text;
57
+
58
+ this.icon = this.calcIcon(model);
57
59
  }
58
60
  }
@@ -1,6 +1,7 @@
1
- import { IDETreeDataSetNode } from '@ibiz/model-core';
2
- import { ITreeNodeData } from '../../../interface';
1
+ import { IDETreeDataSetNode, IDETreeNodeDataItem } from '@ibiz/model-core';
2
+ import { IIcon, ITreeNodeData } from '../../../interface';
3
3
  import { calcDeCodeNameById } from '../../../model';
4
+ import { ScriptFactory } from '../../../utils';
4
5
  import { TreeNodeData } from './tree-node-data';
5
6
 
6
7
  /**
@@ -51,5 +52,62 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
51
52
 
52
53
  this.srfkey = this.deData.srfkey;
53
54
  this.srfmajortext = this.deData.srfmajortext;
55
+
56
+ this.icon = this.calcIcon(model);
57
+ this.textHtml = this.calcTextHtml(model);
58
+ }
59
+
60
+ protected calcIcon(model: IDETreeDataSetNode): IIcon | undefined {
61
+ const icon = super.calcIcon(model) || {};
62
+ const { iconAppDEFieldId, detreeNodeDataItems } = model;
63
+ if (iconAppDEFieldId && this.deData[iconAppDEFieldId]) {
64
+ icon.imagePath = this.deData[iconAppDEFieldId];
65
+ }
66
+
67
+ if (icon) {
68
+ this.icon = icon;
69
+ }
70
+ const iconDataItem = detreeNodeDataItems?.find(item => item.id === 'icon');
71
+ if (iconDataItem) {
72
+ icon.htmlStr = this.calcDataItemScript(iconDataItem);
73
+ }
74
+ return Object.values(icon).length > 0 ? icon : undefined;
75
+ }
76
+
77
+ /**
78
+ * 计算节点数据项的自定义脚本内容
79
+ * @author lxm
80
+ * @date 2023-08-15 02:37:29
81
+ * @protected
82
+ * @param {IDETreeNodeDataItem} dataItem
83
+ * @return {*} {(string | undefined)}
84
+ */
85
+ protected calcDataItemScript(
86
+ dataItem: IDETreeNodeDataItem,
87
+ ): string | undefined {
88
+ if (dataItem.customCode && dataItem.scriptCode) {
89
+ return ScriptFactory.execScriptFn(
90
+ { data: this.deData },
91
+ dataItem.scriptCode,
92
+ ) as string;
93
+ }
94
+ }
95
+
96
+ /**
97
+ * 计算节点文本html内容
98
+ * @author lxm
99
+ * @date 2023-08-15 02:41:31
100
+ * @protected
101
+ * @param {IDETreeDataSetNode} model
102
+ * @return {*} {(string | undefined)}
103
+ */
104
+ protected calcTextHtml(model: IDETreeDataSetNode): string | undefined {
105
+ let html: string | undefined;
106
+ const { detreeNodeDataItems } = model;
107
+ const textDataItem = detreeNodeDataItems?.find(item => item.id === 'text');
108
+ if (textDataItem) {
109
+ html = this.calcDataItemScript(textDataItem);
110
+ }
111
+ return html;
54
112
  }
55
113
  }
@@ -1,5 +1,5 @@
1
1
  import { IDETreeNode } from '@ibiz/model-core';
2
- import { ITreeNodeData } from '../../../interface';
2
+ import { IIcon, ITreeNodeData } from '../../../interface';
3
3
 
4
4
  /**
5
5
  * 树节点数据基类
@@ -33,6 +33,10 @@ export abstract class TreeNodeData implements ITreeNodeData {
33
33
 
34
34
  parent?: ITreeNodeData;
35
35
 
36
+ icon?: IIcon;
37
+
38
+ textHtml?: string;
39
+
36
40
  constructor(
37
41
  model: IDETreeNode,
38
42
  parentNodeData: ITreeNodeData | undefined,
@@ -56,7 +60,27 @@ export abstract class TreeNodeData implements ITreeNodeData {
56
60
  }
57
61
 
58
62
  this.nodeId = model.id!;
59
- // todo 是否有自己点跟是否搜索有关
60
- // this.leaf = model.tree.getChildNodes(model.id, opts.hasQuery).length === 0;
63
+ }
64
+
65
+ /**
66
+ * 计算节点图标
67
+ * @author lxm
68
+ * @date 2023-08-15 02:24:55
69
+ * @protected
70
+ * @param {IDETreeNode} model
71
+ * @return {*} {(IIcon | undefined)}
72
+ */
73
+ protected calcIcon(model: IDETreeNode): IIcon | undefined {
74
+ const { sysImage } = model;
75
+ const icon: IIcon = {};
76
+ if (sysImage) {
77
+ if (sysImage.cssClass) {
78
+ icon.cssClass = sysImage.cssClass;
79
+ }
80
+ if (sysImage.imagePath) {
81
+ icon.imagePath = sysImage.imagePath;
82
+ }
83
+ }
84
+ return Object.values(icon).length > 0 ? icon : undefined;
61
85
  }
62
86
  }
@@ -50,5 +50,7 @@ export class TreeStaticNodeData extends TreeNodeData implements ITreeNodeData {
50
50
 
51
51
  this.srfkey = this.deData?.srfkey || this.value;
52
52
  this.srfmajortext = this.deData?.srfmajortext || this.text;
53
+
54
+ this.icon = this.calcIcon(model);
53
55
  }
54
56
  }
package/src/types.ts CHANGED
@@ -12,10 +12,10 @@ import {
12
12
  IOverlayController,
13
13
  IGlobalConfig,
14
14
  IAppHubService,
15
+ IAuthService,
15
16
  } from './interface';
16
17
  import { LogicSchedulerCenter } from './logic-scheduler';
17
18
  import { RegisterCenter } from './register/register-center';
18
- import { AuthService } from './service';
19
19
 
20
20
  declare module '@ibiz-template/core' {
21
21
  interface IBizSys {
@@ -128,9 +128,9 @@ declare module '@ibiz-template/core' {
128
128
  *
129
129
  * @author chitanda
130
130
  * @date 2022-07-20 10:07:33
131
- * @type {AuthService}
131
+ * @type {IAuthService}
132
132
  */
133
- auth: AuthService;
133
+ auth: IAuthService;
134
134
 
135
135
  /**
136
136
  * 引擎工厂
@@ -93,7 +93,7 @@ export class FrontUIActionProvider extends UIActionProviderBase {
93
93
  const result = ScriptFactory.execScriptFn(
94
94
  { context, params, data, el: event?.target },
95
95
  scriptCode,
96
- );
96
+ ) as IUIActionResult | undefined;
97
97
  return result || {};
98
98
  }
99
99
  throw new RuntimeModelError(action, '自定义类型缺少配置脚本代码');