@ibiz-template/runtime 0.5.0-beta.5 → 0.5.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +238 -151
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +1 -0
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +5 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +0 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +5 -6
- package/out/controller/control/gantt/gantt.controller.js +2 -2
- package/out/controller/control/gantt/gantt.service.js +2 -2
- package/out/controller/control/grid/grid/grid.controller.d.ts +3 -1
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +8 -5
- package/out/controller/control/tree/tree.controller.d.ts +7 -2
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +59 -59
- package/out/controller/control/tree/tree.service.js +8 -8
- package/out/controller/control/tree-grid/tree-grid.controller.d.ts +35 -2
- package/out/controller/control/tree-grid/tree-grid.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid/tree-grid.controller.js +60 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +6 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts +1 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-tree-grid.controller.d.ts +11 -1
- package/out/interface/controller/controller/control/i-tree-grid.controller.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -2
- package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree-grid.state.d.ts +5 -0
- package/out/interface/controller/state/control/i-tree-grid.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree.state.d.ts +26 -25
- package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
- package/out/interface/service/service/i-auth.service.d.ts +23 -0
- package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
- package/out/interface/service/service/index.d.ts +1 -1
- package/out/interface/service/service/index.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts +3 -1
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +26 -3
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +4 -3
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +3 -3
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.js +9 -9
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +19 -21
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +12 -13
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +10 -8
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-static-node-data.js +10 -10
- package/package.json +3 -3
- package/src/app-hub.ts +6 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +5 -6
- package/src/controller/control/gantt/gantt.controller.ts +2 -2
- package/src/controller/control/gantt/gantt.service.ts +2 -2
- package/src/controller/control/grid/grid/grid.controller.ts +17 -8
- package/src/controller/control/tree/tree.controller.ts +61 -61
- package/src/controller/control/tree/tree.service.ts +8 -8
- package/src/controller/control/tree-grid/tree-grid.controller.ts +79 -4
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +7 -0
- package/src/interface/controller/controller/control/i-grid.controller.ts +5 -2
- package/src/interface/controller/controller/control/i-tree-grid.controller.ts +16 -1
- package/src/interface/controller/state/control/i-gantt.state.ts +2 -2
- package/src/interface/controller/state/control/i-tree-grid.state.ts +7 -1
- package/src/interface/controller/state/control/i-tree.state.ts +27 -25
- package/src/interface/service/service/i-auth.service.ts +26 -0
- package/src/interface/service/service/index.ts +1 -1
- package/src/service/service/auth/v7-auth.service.ts +31 -2
- package/src/service/service/entity/method/de-action.ts +4 -3
- package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +2 -2
- package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +12 -12
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +26 -29
- package/src/service/vo/tree-node-data/tree-node-data.ts +20 -20
- package/src/service/vo/tree-node-data/tree-static-node-data.ts +14 -14
|
@@ -12,6 +12,8 @@ import { IMDControlState } from './i-md-control.state';
|
|
|
12
12
|
export interface ITreeState extends IMDControlState {
|
|
13
13
|
items: ITreeNodeData[];
|
|
14
14
|
|
|
15
|
+
selectedData: ITreeNodeData[];
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* 树的根节点
|
|
17
19
|
*
|
|
@@ -69,7 +71,7 @@ export interface ITreeState extends IMDControlState {
|
|
|
69
71
|
* @export
|
|
70
72
|
* @class ITreeNodeData
|
|
71
73
|
*/
|
|
72
|
-
export interface ITreeNodeData
|
|
74
|
+
export interface ITreeNodeData {
|
|
73
75
|
/**
|
|
74
76
|
* 节点数据的唯一标识(创建的时候自动生成)
|
|
75
77
|
* @author lxm
|
|
@@ -92,7 +94,7 @@ export interface ITreeNodeData extends IData {
|
|
|
92
94
|
* @type {string}
|
|
93
95
|
* @memberof ITreeNodeData
|
|
94
96
|
*/
|
|
95
|
-
|
|
97
|
+
_nodeId: string;
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
100
|
* 节点唯一标识,在父的id上加上自身的唯一标识,用>分隔
|
|
@@ -101,7 +103,7 @@ export interface ITreeNodeData extends IData {
|
|
|
101
103
|
* @type {string}
|
|
102
104
|
* @memberof ITreeNodeData
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
_id: string;
|
|
105
107
|
|
|
106
108
|
/**
|
|
107
109
|
* 节点的值(可能是自己的主键,也可能是沿用父的值)
|
|
@@ -110,7 +112,7 @@ export interface ITreeNodeData extends IData {
|
|
|
110
112
|
* @type {string}
|
|
111
113
|
* @memberof ITreeNodeData
|
|
112
114
|
*/
|
|
113
|
-
|
|
115
|
+
_value?: string;
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
118
|
* 节点显示名称
|
|
@@ -118,7 +120,7 @@ export interface ITreeNodeData extends IData {
|
|
|
118
120
|
* @type {string}
|
|
119
121
|
* @memberof ITreeNodeData
|
|
120
122
|
*/
|
|
121
|
-
|
|
123
|
+
_text: string;
|
|
122
124
|
|
|
123
125
|
/**
|
|
124
126
|
* 是否是叶子节点(没有子节点的节点)
|
|
@@ -126,7 +128,7 @@ export interface ITreeNodeData extends IData {
|
|
|
126
128
|
* @type {boolean}
|
|
127
129
|
* @memberof ITreeNodeData
|
|
128
130
|
*/
|
|
129
|
-
|
|
131
|
+
_leaf: boolean;
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
134
|
* 资源路径相关上下文参数
|
|
@@ -136,7 +138,7 @@ export interface ITreeNodeData extends IData {
|
|
|
136
138
|
* @type {IParams}
|
|
137
139
|
* @memberof ITreeNodeData
|
|
138
140
|
*/
|
|
139
|
-
|
|
141
|
+
_context?: IParams;
|
|
140
142
|
|
|
141
143
|
/**
|
|
142
144
|
* 关系上转换的视图参数
|
|
@@ -144,7 +146,7 @@ export interface ITreeNodeData extends IData {
|
|
|
144
146
|
* @type {IParams}
|
|
145
147
|
* @memberof ITreeNodeData
|
|
146
148
|
*/
|
|
147
|
-
|
|
149
|
+
_params?: IParams;
|
|
148
150
|
|
|
149
151
|
/**
|
|
150
152
|
* 子节点集合(没有子节点则不存在)
|
|
@@ -152,7 +154,7 @@ export interface ITreeNodeData extends IData {
|
|
|
152
154
|
* @type {ITreeNodeData[]}
|
|
153
155
|
* @memberof ITreeNodeData
|
|
154
156
|
*/
|
|
155
|
-
|
|
157
|
+
_children?: ITreeNodeData[];
|
|
156
158
|
|
|
157
159
|
/**
|
|
158
160
|
* 父节点数据对象
|
|
@@ -160,7 +162,7 @@ export interface ITreeNodeData extends IData {
|
|
|
160
162
|
* @type {ITreeNodeData}
|
|
161
163
|
* @memberof ITreeNodeData
|
|
162
164
|
*/
|
|
163
|
-
|
|
165
|
+
_parent?: ITreeNodeData;
|
|
164
166
|
|
|
165
167
|
/**
|
|
166
168
|
* 实体数据
|
|
@@ -168,39 +170,39 @@ export interface ITreeNodeData extends IData {
|
|
|
168
170
|
* @type {IData}
|
|
169
171
|
* @memberof ITreeNodeData
|
|
170
172
|
*/
|
|
171
|
-
|
|
173
|
+
_deData?: IData;
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
|
-
*
|
|
176
|
+
* 图标
|
|
175
177
|
* @author lxm
|
|
176
|
-
* @date 2023-
|
|
177
|
-
* @type {
|
|
178
|
+
* @date 2023-08-15 02:02:49
|
|
179
|
+
* @type {IIcon}
|
|
178
180
|
*/
|
|
179
|
-
|
|
181
|
+
_icon?: IIcon;
|
|
180
182
|
|
|
181
183
|
/**
|
|
182
|
-
*
|
|
184
|
+
* 节点文本的html显示
|
|
183
185
|
* @author lxm
|
|
184
|
-
* @date 2023-
|
|
186
|
+
* @date 2023-08-15 02:15:09
|
|
185
187
|
* @type {string}
|
|
186
188
|
*/
|
|
187
|
-
|
|
189
|
+
_textHtml?: string;
|
|
188
190
|
|
|
189
191
|
/**
|
|
190
|
-
*
|
|
192
|
+
* 作为实体数据时的主键
|
|
191
193
|
* @author lxm
|
|
192
|
-
* @date 2023-
|
|
193
|
-
* @type {
|
|
194
|
+
* @date 2023-05-29 09:28:59
|
|
195
|
+
* @type {string}
|
|
194
196
|
*/
|
|
195
|
-
|
|
197
|
+
srfkey?: string;
|
|
196
198
|
|
|
197
199
|
/**
|
|
198
|
-
*
|
|
200
|
+
* 作为实体数据时的主信息
|
|
199
201
|
* @author lxm
|
|
200
|
-
* @date 2023-
|
|
202
|
+
* @date 2023-05-29 09:29:00
|
|
201
203
|
* @type {string}
|
|
202
204
|
*/
|
|
203
|
-
|
|
205
|
+
srfmajortext?: string;
|
|
204
206
|
|
|
205
207
|
// todo 其他界面绘制相关属性
|
|
206
208
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export interface IAuthInfo {
|
|
2
|
+
/**
|
|
3
|
+
* 是否是匿名账户登录
|
|
4
|
+
* @author lxm
|
|
5
|
+
* @date 2024-01-03 05:25:31
|
|
6
|
+
* @type {boolean}
|
|
7
|
+
*/
|
|
8
|
+
isAnonymous: boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 访问令牌
|
|
12
|
+
* @author lxm
|
|
13
|
+
* @date 2024-01-03 05:30:43
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
token: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* 认证服务
|
|
3
21
|
*
|
|
@@ -59,4 +77,12 @@ export interface IAuthService {
|
|
|
59
77
|
* @return {*} {Promise<void>}
|
|
60
78
|
*/
|
|
61
79
|
extendLogin(): Promise<void>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 获取当前环境的权限信息(无登录则返回undefined)
|
|
83
|
+
* @author lxm
|
|
84
|
+
* @date 2024-01-03 05:31:48
|
|
85
|
+
* @return {*} {(Promise<IAuthInfo | undefined>)}
|
|
86
|
+
*/
|
|
87
|
+
getAuthInfo(): IAuthInfo | undefined;
|
|
62
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { IAppDeAuthorityService } from './i-app-de-authority.service';
|
|
2
2
|
export type { IConfigService } from './i-config.service';
|
|
3
3
|
export type { IAppDEService } from './i-app-de.service';
|
|
4
|
-
export type { IAuthService } from './i-auth.service';
|
|
4
|
+
export type { IAuthService, IAuthInfo } from './i-auth.service';
|
|
5
5
|
export type { IFileService } from './i-file.service';
|
|
6
6
|
export type { IWorkFlowService } from './i-wf.service';
|
|
7
7
|
export type { IAsyncActionService } from './i-async-action.service';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CoreConst, HttpError } from '@ibiz-template/core';
|
|
2
2
|
import { clearCookie, getCookie, setCookie } from 'qx-util';
|
|
3
3
|
import { IAuthService } from '../../../interface';
|
|
4
|
+
import { IAuthInfo } from '../../../interface/service/service/i-auth.service';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* 认证服务
|
|
@@ -11,7 +12,9 @@ import { IAuthService } from '../../../interface';
|
|
|
11
12
|
* @class AuthService
|
|
12
13
|
*/
|
|
13
14
|
export class V7AuthService implements IAuthService {
|
|
14
|
-
isAnonymous
|
|
15
|
+
get isAnonymous(): boolean {
|
|
16
|
+
return getCookie(CoreConst.IS_ANONYMOUS) === '1';
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
async anonymousLogin(): Promise<boolean> {
|
|
17
20
|
const { anonymousUser, anonymousPwd } = ibiz.env;
|
|
@@ -21,7 +24,15 @@ export class V7AuthService implements IAuthService {
|
|
|
21
24
|
}
|
|
22
25
|
const result = await this.login(anonymousUser, anonymousPwd);
|
|
23
26
|
if (result) {
|
|
24
|
-
|
|
27
|
+
setCookie(CoreConst.IS_ANONYMOUS, '1', 0, true);
|
|
28
|
+
|
|
29
|
+
// 全部改成session级别的
|
|
30
|
+
const token = getCookie(CoreConst.TOKEN)!;
|
|
31
|
+
const expirein = getCookie(CoreConst.TOKEN_EXPIRES)!;
|
|
32
|
+
const remember = getCookie(CoreConst.TOKEN_REMEMBER)!;
|
|
33
|
+
setCookie(CoreConst.TOKEN, token, 0, true);
|
|
34
|
+
setCookie(CoreConst.TOKEN_EXPIRES, expirein, 0, true);
|
|
35
|
+
setCookie(CoreConst.TOKEN_REMEMBER, remember, 0, true);
|
|
25
36
|
}
|
|
26
37
|
return result;
|
|
27
38
|
}
|
|
@@ -52,6 +63,7 @@ export class V7AuthService implements IAuthService {
|
|
|
52
63
|
remember ? 7 : 0,
|
|
53
64
|
true,
|
|
54
65
|
);
|
|
66
|
+
clearCookie(CoreConst.IS_ANONYMOUS);
|
|
55
67
|
}
|
|
56
68
|
return true;
|
|
57
69
|
} catch (err: unknown) {
|
|
@@ -69,6 +81,7 @@ export class V7AuthService implements IAuthService {
|
|
|
69
81
|
clearCookie(CoreConst.TOKEN);
|
|
70
82
|
clearCookie(CoreConst.TOKEN_EXPIRES);
|
|
71
83
|
clearCookie(CoreConst.TOKEN_REMEMBER);
|
|
84
|
+
clearCookie(CoreConst.IS_ANONYMOUS);
|
|
72
85
|
return true;
|
|
73
86
|
} catch (err: unknown) {
|
|
74
87
|
ibiz.notification.error({
|
|
@@ -80,6 +93,11 @@ export class V7AuthService implements IAuthService {
|
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
async extendLogin(): Promise<void> {
|
|
96
|
+
if (this.isAnonymous) {
|
|
97
|
+
// 匿名登录不需要延长都是会话级的
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
83
101
|
const token = getCookie(CoreConst.TOKEN);
|
|
84
102
|
const expirein = getCookie(CoreConst.TOKEN_EXPIRES);
|
|
85
103
|
const remember = getCookie(CoreConst.TOKEN_REMEMBER);
|
|
@@ -106,4 +124,15 @@ export class V7AuthService implements IAuthService {
|
|
|
106
124
|
}, wait);
|
|
107
125
|
}
|
|
108
126
|
}
|
|
127
|
+
|
|
128
|
+
getAuthInfo(): IAuthInfo | undefined {
|
|
129
|
+
const token = getCookie(CoreConst.TOKEN);
|
|
130
|
+
const isAnonymous = !!getCookie(CoreConst.IS_ANONYMOUS);
|
|
131
|
+
return token
|
|
132
|
+
? {
|
|
133
|
+
token,
|
|
134
|
+
isAnonymous,
|
|
135
|
+
}
|
|
136
|
+
: undefined;
|
|
137
|
+
}
|
|
109
138
|
}
|
|
@@ -337,7 +337,7 @@ export class DEActionMethod extends Method {
|
|
|
337
337
|
try {
|
|
338
338
|
let key = null;
|
|
339
339
|
if (params) {
|
|
340
|
-
|
|
340
|
+
key = params[this.entity.keyAppDEFieldId!.toLowerCase()];
|
|
341
341
|
}
|
|
342
342
|
if (!key && context) {
|
|
343
343
|
key = context[this.entity.codeName!.toLowerCase()];
|
|
@@ -406,7 +406,7 @@ export class DEActionMethod extends Method {
|
|
|
406
406
|
try {
|
|
407
407
|
let key = null;
|
|
408
408
|
if (params) {
|
|
409
|
-
|
|
409
|
+
key = params[this.entity.keyAppDEFieldId!.toLowerCase()];
|
|
410
410
|
}
|
|
411
411
|
if (!key && context) {
|
|
412
412
|
key = context[this.entity.codeName!.toLowerCase()];
|
|
@@ -467,7 +467,8 @@ export class DEActionMethod extends Method {
|
|
|
467
467
|
const majorLowerCodeName = majorDECodeName.toLowerCase();
|
|
468
468
|
const pickupLowerDEFName = pickupDEFName.toLowerCase();
|
|
469
469
|
const majorkey = context[majorLowerCodeName];
|
|
470
|
-
|
|
470
|
+
// 父主键不能是自身,否则自关系的时候就改错了
|
|
471
|
+
if (majorkey && majorkey !== data.srfkey) {
|
|
471
472
|
data[pickupLowerDEFName] = majorkey;
|
|
472
473
|
}
|
|
473
474
|
});
|
|
@@ -19,9 +19,9 @@ export class GanttCodeListNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -19,9 +19,9 @@ export class GanttDataSetNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -19,9 +19,9 @@ export class GanttStaticNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -15,11 +15,11 @@ export class TreeCodeListNodeData
|
|
|
15
15
|
extends TreeNodeData
|
|
16
16
|
implements ITreeNodeData
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
_text: string;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
_id!: string;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_value: string;
|
|
23
23
|
|
|
24
24
|
constructor(
|
|
25
25
|
model: IDETreeDataSetNode,
|
|
@@ -33,14 +33,14 @@ export class TreeCodeListNodeData
|
|
|
33
33
|
) {
|
|
34
34
|
super(model, parentNodeData, opts);
|
|
35
35
|
const { data } = opts;
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
36
|
+
this._text = data.text;
|
|
37
|
+
this._value = data.value as string;
|
|
38
38
|
|
|
39
39
|
// id小写
|
|
40
|
-
const selfId = `${model.id}@${this.
|
|
40
|
+
const selfId = `${model.id}@${this._value}`.toLowerCase();
|
|
41
41
|
Object.defineProperty(this, 'id', {
|
|
42
42
|
get() {
|
|
43
|
-
return this.
|
|
43
|
+
return this._parent ? `${this._parent.id}:${selfId}` : selfId;
|
|
44
44
|
},
|
|
45
45
|
enumerable: true,
|
|
46
46
|
configurable: true,
|
|
@@ -49,14 +49,14 @@ export class TreeCodeListNodeData
|
|
|
49
49
|
// 实体节点额外添加上自己的实体上下文
|
|
50
50
|
if (model.appDataEntityId) {
|
|
51
51
|
const deName = calcDeCodeNameById(model.appDataEntityId);
|
|
52
|
-
this.
|
|
53
|
-
[deName]: this.
|
|
52
|
+
this._context = Object.assign(this._context || {}, {
|
|
53
|
+
[deName]: this._value,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
this.srfkey = this.
|
|
58
|
-
this.srfmajortext = this.
|
|
57
|
+
this.srfkey = this._value;
|
|
58
|
+
this.srfmajortext = this._text;
|
|
59
59
|
|
|
60
|
-
this.
|
|
60
|
+
this._icon = this.calcIcon(model);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -16,13 +16,13 @@ import { fieldValueToBoolean } from '../../utils';
|
|
|
16
16
|
* @implements {ITreeNodeData}
|
|
17
17
|
*/
|
|
18
18
|
export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
19
|
-
|
|
19
|
+
_text: string;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_id!: string;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
_value: string;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
_deData: IData;
|
|
26
26
|
|
|
27
27
|
constructor(
|
|
28
28
|
model: IDETreeDataSetNode,
|
|
@@ -36,11 +36,11 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
36
36
|
) {
|
|
37
37
|
super(model, parentNodeData, opts);
|
|
38
38
|
const { data } = opts;
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
39
|
+
this._deData = data;
|
|
40
|
+
this._text = model.textAppDEFieldId
|
|
41
41
|
? data[model.textAppDEFieldId]
|
|
42
42
|
: data.srfmajortext;
|
|
43
|
-
this.
|
|
43
|
+
this._value = model.idAppDEFieldId
|
|
44
44
|
? data[model.idAppDEFieldId]
|
|
45
45
|
: data.srfkey;
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
48
48
|
const selfId = `${model.id}@${data.srfkey}`.toLowerCase();
|
|
49
49
|
Object.defineProperty(this, 'id', {
|
|
50
50
|
get() {
|
|
51
|
-
return this.
|
|
51
|
+
return this._parent ? `${this._parent.id}:${selfId}` : selfId;
|
|
52
52
|
},
|
|
53
53
|
enumerable: true,
|
|
54
54
|
configurable: true,
|
|
@@ -57,20 +57,17 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
57
57
|
// 实体节点额外添加上自己的实体上下文
|
|
58
58
|
if (model.appDataEntityId) {
|
|
59
59
|
const deName = calcDeCodeNameById(model.appDataEntityId);
|
|
60
|
-
this.
|
|
60
|
+
this._context = Object.assign(this._context || {}, {
|
|
61
61
|
[deName]: data.srfkey,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
this.icon = this.calcIcon(model);
|
|
69
|
-
this.textHtml = this.calcTextHtml(model);
|
|
65
|
+
this._icon = this.calcIcon(model);
|
|
66
|
+
this._textHtml = this.calcTextHtml(model);
|
|
70
67
|
|
|
71
68
|
// 识别叶子节点标识属性,根据后台数据赋值leaf
|
|
72
69
|
if (model.leafFlagAppDEFieldId) {
|
|
73
|
-
this.
|
|
70
|
+
this._leaf = fieldValueToBoolean(data[model.leafFlagAppDEFieldId]);
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
/** 数据项映射 */
|
|
@@ -88,25 +85,25 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
88
85
|
|
|
89
86
|
return new Proxy<TreeDataSetNodeData>(this, {
|
|
90
87
|
set(target, p, value): boolean {
|
|
91
|
-
if (Object.prototype.hasOwnProperty.call(target.
|
|
92
|
-
target.
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(target._deData, p)) {
|
|
89
|
+
target._deData[p] = value;
|
|
93
90
|
} else if (dataItemkeyMap.has(p)) {
|
|
94
|
-
target.
|
|
91
|
+
target._deData[dataItemkeyMap.get(p)!] = value;
|
|
95
92
|
} else {
|
|
96
|
-
target[p] = value;
|
|
93
|
+
(target as IData)[p] = value;
|
|
97
94
|
}
|
|
98
95
|
return true;
|
|
99
96
|
},
|
|
100
97
|
|
|
101
98
|
get(target, p, _receiver): unknown {
|
|
102
|
-
if (target[p] !== undefined) {
|
|
103
|
-
return target[p];
|
|
99
|
+
if ((target as IData)[p] !== undefined) {
|
|
100
|
+
return (target as IData)[p];
|
|
104
101
|
}
|
|
105
102
|
if (dataItemkeyMap.has(p)) {
|
|
106
|
-
return target.
|
|
103
|
+
return target._deData[dataItemkeyMap.get(p)!] || dataItemDefaults[p];
|
|
107
104
|
}
|
|
108
|
-
if (target.
|
|
109
|
-
return target.
|
|
105
|
+
if (target._deData[p] !== undefined) {
|
|
106
|
+
return target._deData[p];
|
|
110
107
|
}
|
|
111
108
|
},
|
|
112
109
|
|
|
@@ -116,7 +113,7 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
116
113
|
...new Set([
|
|
117
114
|
...Object.keys(target),
|
|
118
115
|
...dataItemkeyMap.keys(),
|
|
119
|
-
...Object.keys(target.
|
|
116
|
+
...Object.keys(target._deData),
|
|
120
117
|
]),
|
|
121
118
|
];
|
|
122
119
|
updateKeyDefine(target, allKeys);
|
|
@@ -128,12 +125,12 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
128
125
|
protected calcIcon(model: IDETreeDataSetNode): IIcon | undefined {
|
|
129
126
|
const icon = super.calcIcon(model) || {};
|
|
130
127
|
const { iconAppDEFieldId, detreeNodeDataItems } = model;
|
|
131
|
-
if (iconAppDEFieldId && this.
|
|
132
|
-
icon.imagePath = this.
|
|
128
|
+
if (iconAppDEFieldId && this._deData[iconAppDEFieldId]) {
|
|
129
|
+
icon.imagePath = this._deData[iconAppDEFieldId];
|
|
133
130
|
}
|
|
134
131
|
|
|
135
132
|
if (icon) {
|
|
136
|
-
this.
|
|
133
|
+
this._icon = icon;
|
|
137
134
|
}
|
|
138
135
|
const iconDataItem = detreeNodeDataItems?.find(item => item.id === 'icon');
|
|
139
136
|
if (iconDataItem) {
|
|
@@ -155,7 +152,7 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
155
152
|
): string | undefined {
|
|
156
153
|
if (dataItem.customCode && dataItem.scriptCode) {
|
|
157
154
|
return ScriptFactory.execScriptFn(
|
|
158
|
-
{ data: this.
|
|
155
|
+
{ data: this._deData },
|
|
159
156
|
dataItem.scriptCode,
|
|
160
157
|
{
|
|
161
158
|
isAsync: false,
|
|
@@ -14,61 +14,61 @@ export abstract class TreeNodeData implements ITreeNodeData {
|
|
|
14
14
|
|
|
15
15
|
_nodeType: string;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
_id!: string;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
_value?: string | undefined;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_text!: string;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
_children?: ITreeNodeData[] | undefined;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
_deData?: IData | undefined;
|
|
26
26
|
|
|
27
27
|
srfkey?: string | undefined;
|
|
28
28
|
|
|
29
29
|
srfmajortext?: string | undefined;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
_nodeId: string;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
_leaf: boolean = false;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
_context?: IParams;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
_params?: IParams;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
_parent?: ITreeNodeData;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
_icon?: IIcon;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
_textHtml?: string;
|
|
44
44
|
|
|
45
45
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
[key: string | symbol]: any;
|
|
46
|
+
// [key: string | symbol]: any;
|
|
47
47
|
|
|
48
48
|
constructor(
|
|
49
49
|
model: IDETreeNode,
|
|
50
50
|
parentNodeData: ITreeNodeData | undefined,
|
|
51
51
|
opts: { leaf: boolean; navContext?: IParams; navParams?: IParams },
|
|
52
52
|
) {
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
53
|
+
this._leaf = opts.leaf === true;
|
|
54
|
+
this._parent = parentNodeData;
|
|
55
55
|
this._nodeType = model.treeNodeType!;
|
|
56
56
|
|
|
57
57
|
// 所有节点都要继承父的上下文,如果父存在则复制父的资源上下文,否则返回空对象。
|
|
58
|
-
if (this.
|
|
59
|
-
this.
|
|
58
|
+
if (this._parent) {
|
|
59
|
+
this._context = { ...this._parent._context };
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// 附加导航上下文和视图参数
|
|
63
63
|
if (opts.navContext) {
|
|
64
|
-
this.
|
|
64
|
+
this._context = Object.assign(this._context || {}, opts.navContext);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (opts.navParams) {
|
|
68
|
-
this.
|
|
68
|
+
this._params = { ...opts.navParams };
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
this.
|
|
71
|
+
this._nodeId = model.id!;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -11,13 +11,13 @@ import { TreeNodeData } from './tree-node-data';
|
|
|
11
11
|
* @implements {ITreeNodeData}
|
|
12
12
|
*/
|
|
13
13
|
export class TreeStaticNodeData extends TreeNodeData implements ITreeNodeData {
|
|
14
|
-
|
|
14
|
+
_text: string;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
_id!: string;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
_value?: string;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
_deData?: IData;
|
|
21
21
|
|
|
22
22
|
constructor(
|
|
23
23
|
model: IDETreeStaticNode,
|
|
@@ -32,32 +32,32 @@ export class TreeStaticNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
32
32
|
const selfId = `${model.id}`.toLowerCase();
|
|
33
33
|
Object.defineProperty(this, 'id', {
|
|
34
34
|
get() {
|
|
35
|
-
return this.
|
|
35
|
+
return this._parent ? `${this._parent.id}:${selfId}` : selfId;
|
|
36
36
|
},
|
|
37
37
|
enumerable: true,
|
|
38
38
|
configurable: true,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
41
|
+
this._text = model.text!;
|
|
42
|
+
this._value = nodeValue;
|
|
43
43
|
|
|
44
44
|
// 静态节点数据去对应级别的父节点数据
|
|
45
45
|
if (parentNodeData && opts.parentValueLevel) {
|
|
46
46
|
// 根据父值级别查找父数据
|
|
47
47
|
let parent: ITreeNodeData | undefined = parentNodeData;
|
|
48
48
|
for (let index = 1; index < opts.parentValueLevel!; index++) {
|
|
49
|
-
parent = parent?.
|
|
49
|
+
parent = parent?._parent;
|
|
50
50
|
}
|
|
51
|
-
if (parent?.
|
|
52
|
-
this.
|
|
51
|
+
if (parent?._deData) {
|
|
52
|
+
this._deData = parent._deData;
|
|
53
53
|
}
|
|
54
54
|
// 静态节点值不存在时,取父数据的值
|
|
55
|
-
this.
|
|
55
|
+
this._value = nodeValue || parent?._value;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
this.srfkey = this.
|
|
59
|
-
this.srfmajortext = this.
|
|
58
|
+
this.srfkey = this._deData?.srfkey || this._value;
|
|
59
|
+
this.srfmajortext = this._deData?.srfmajortext || this._text;
|
|
60
60
|
|
|
61
|
-
this.
|
|
61
|
+
this._icon = this.calcIcon(model);
|
|
62
62
|
}
|
|
63
63
|
}
|