@ibiz-template/runtime 0.5.0-beta.0 → 0.5.0-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.
Files changed (80) hide show
  1. package/dist/index.esm.js +372 -556
  2. package/dist/index.system.min.js +2 -2
  3. package/out/controller/common/control/md-control.controller.d.ts +21 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +31 -0
  6. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  7. package/out/controller/control/form/edit-form/edit-form.controller.js +2 -1
  8. package/out/controller/control/gantt/gantt.controller.d.ts +6 -189
  9. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  10. package/out/controller/control/gantt/gantt.controller.js +6 -412
  11. package/out/controller/control/gantt/gantt.service.d.ts +2 -2
  12. package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
  13. package/out/controller/control/gantt/gantt.service.js +5 -5
  14. package/out/controller/control/list/list.controller.d.ts +1 -30
  15. package/out/controller/control/list/list.controller.d.ts.map +1 -1
  16. package/out/controller/control/list/list.controller.js +0 -41
  17. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  18. package/out/controller/control/search-bar/search-bar.controller.js +48 -4
  19. package/out/controller/control/search-bar/search-bar.service.d.ts +24 -0
  20. package/out/controller/control/search-bar/search-bar.service.d.ts.map +1 -1
  21. package/out/controller/control/search-bar/search-bar.service.js +62 -16
  22. package/out/interface/controller/event/control/i-gantt.event.d.ts +2 -44
  23. package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
  24. package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -41
  25. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  26. package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -1
  27. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  28. package/out/interface/service/i-parent-config/i-parent-config.d.ts +67 -0
  29. package/out/interface/service/i-parent-config/i-parent-config.d.ts.map +1 -0
  30. package/out/interface/service/i-parent-config/i-parent-config.js +1 -0
  31. package/out/interface/service/index.d.ts +1 -0
  32. package/out/interface/service/index.d.ts.map +1 -1
  33. package/out/interface/service/service/i-auth.service.d.ts +17 -0
  34. package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
  35. package/out/service/dto/method.dto.d.ts +21 -1
  36. package/out/service/dto/method.dto.d.ts.map +1 -1
  37. package/out/service/dto/method.dto.js +65 -3
  38. package/out/service/service/auth/v7-auth.service.d.ts +2 -0
  39. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  40. package/out/service/service/auth/v7-auth.service.js +15 -0
  41. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +0 -1
  42. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  43. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.js +1 -2
  44. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts +0 -7
  45. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts.map +1 -1
  46. package/out/service/vo/gantt-node-data/gantt-node-data-util.js +0 -18
  47. package/out/ui-action/provider/ui-action-provider-base.d.ts +10 -0
  48. package/out/ui-action/provider/ui-action-provider-base.d.ts.map +1 -1
  49. package/out/ui-action/provider/ui-action-provider-base.js +20 -9
  50. package/out/utils/index.d.ts +1 -1
  51. package/out/utils/index.d.ts.map +1 -1
  52. package/out/utils/index.js +1 -1
  53. package/out/utils/open-redirect-view/open-redirect-view.d.ts +25 -1
  54. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  55. package/out/utils/open-redirect-view/open-redirect-view.js +72 -31
  56. package/out/utils/ui-domain/ui-domain.d.ts +28 -0
  57. package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
  58. package/out/utils/ui-domain/ui-domain.js +40 -0
  59. package/package.json +6 -6
  60. package/src/controller/common/control/md-control.controller.ts +43 -0
  61. package/src/controller/control/form/edit-form/edit-form.controller.ts +2 -1
  62. package/src/controller/control/gantt/gantt.controller.ts +7 -492
  63. package/src/controller/control/gantt/gantt.service.ts +5 -5
  64. package/src/controller/control/list/list.controller.ts +0 -54
  65. package/src/controller/control/search-bar/search-bar.controller.ts +63 -10
  66. package/src/controller/control/search-bar/search-bar.service.ts +70 -16
  67. package/src/interface/controller/event/control/i-gantt.event.ts +2 -38
  68. package/src/interface/controller/state/control/i-gantt.state.ts +2 -47
  69. package/src/interface/controller/state/control/i-search-bar.state.ts +9 -1
  70. package/src/interface/service/i-parent-config/i-parent-config.ts +66 -0
  71. package/src/interface/service/index.ts +1 -0
  72. package/src/interface/service/service/i-auth.service.ts +19 -0
  73. package/src/service/dto/method.dto.ts +80 -3
  74. package/src/service/service/auth/v7-auth.service.ts +15 -0
  75. package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +1 -4
  76. package/src/service/vo/gantt-node-data/gantt-node-data-util.ts +0 -21
  77. package/src/ui-action/provider/ui-action-provider-base.ts +34 -15
  78. package/src/utils/index.ts +1 -0
  79. package/src/utils/open-redirect-view/open-redirect-view.ts +93 -38
  80. package/src/utils/ui-domain/ui-domain.ts +44 -0
@@ -65,7 +65,7 @@ export class SearchBarController
65
65
  * @author: zhujiamin
66
66
  * @Date: 2023-12-21 10:17:43
67
67
  */
68
- isBackendSearchGroup = true;
68
+ isBackendSearchGroup = this.model.searchBarStyle === 'SEARCHBAR2';
69
69
 
70
70
  /**
71
71
  * 表格控制器
@@ -103,6 +103,7 @@ export class SearchBarController
103
103
 
104
104
  protected async onCreated(): Promise<void> {
105
105
  await super.onCreated();
106
+
106
107
  const appDataEntity = await ibiz.hub.getAppDataEntity(
107
108
  this.model.appDataEntityId!,
108
109
  this.context.srfappid,
@@ -318,12 +319,46 @@ export class SearchBarController
318
319
  this.state.searchBarGroups = [];
319
320
  if (this.isBackendSearchGroup) {
320
321
  if (this.model.searchBarGroups && this.model.searchBarGroups.length > 0) {
321
- this.state.searchBarGroups = this.model.searchBarGroups.map(item => ({
322
- ...item,
323
- show: true,
324
- saved: false,
325
- searchGroupData: {},
326
- }));
322
+ this.state.searchBarGroups = this.model.searchBarGroups.map(
323
+ (item, index) => {
324
+ const tempGroup = {
325
+ ...item,
326
+ saved: false,
327
+ show: true,
328
+ searchGroupData: {} as IData,
329
+ order: (index + 1) * 100,
330
+ };
331
+ if (item.data) {
332
+ try {
333
+ // 解析data属性到对应位置
334
+ const tempData = JSON.parse(item.data);
335
+ if (tempData.theme_model) {
336
+ if (tempData.theme_model.sort) {
337
+ tempGroup.searchGroupData.sort = tempData.theme_model.sort;
338
+ }
339
+ if (tempData.theme_model.columnstates) {
340
+ tempGroup.searchGroupData.columnstates =
341
+ tempData.theme_model.columnstates;
342
+ }
343
+ if (tempData.theme_model.filternodes) {
344
+ tempGroup.searchGroupData.filternodes =
345
+ tempData.theme_model.filternodes;
346
+ }
347
+ if (tempData.theme_model.searchconds) {
348
+ tempGroup.searchGroupData.searchconds =
349
+ tempData.theme_model.searchconds;
350
+ }
351
+ }
352
+ if (tempData.valid_flag) {
353
+ tempGroup.show = tempData.valid_flag === '1';
354
+ }
355
+ } catch (error) {
356
+ ibiz.log.error(error);
357
+ }
358
+ }
359
+ return tempGroup;
360
+ },
361
+ );
327
362
  }
328
363
  // 请求并合并searchBarGroups ,这里只能拿到清单
329
364
  const res = await this.service.fetch();
@@ -337,16 +372,32 @@ export class SearchBarController
337
372
  mergeInLeft(existGroup, group);
338
373
  existGroup.saved = true;
339
374
  } else {
375
+ // 找出最大的order项的下标index,然后+2新增
376
+ const tempMaxOrderIndex = this.state.searchBarGroups.reduce(
377
+ (maxIndex, item, currentIndex) =>
378
+ item.order > this.state.searchBarGroups[maxIndex].order
379
+ ? currentIndex
380
+ : maxIndex,
381
+ 0,
382
+ );
340
383
  this.state.searchBarGroups.push({
341
- ...group,
342
384
  appId: this.context.srfappid,
343
- show: true,
344
385
  saved: true,
386
+ show: true,
345
387
  searchGroupData: {},
388
+ order: (tempMaxOrderIndex + 2) * 100,
389
+ // 以后台给的为准
390
+ ...group,
346
391
  } as IBackendSearchBarGroup);
347
392
  }
348
393
  });
349
394
  }
395
+ // 按照 order 属性从小到大排序
396
+ this.state.searchBarGroups.sort((a, b) => a.order - b.order);
397
+ // 更新 order 属性的值
398
+ this.state.searchBarGroups.forEach((item, index) => {
399
+ item.order = (index + 1) * 100;
400
+ });
350
401
  }
351
402
  }
352
403
 
@@ -369,8 +420,9 @@ export class SearchBarController
369
420
  // 根据是否保存过决定是更新还是新建
370
421
  if (this.state.selectedSearchGroupItem.saved) {
371
422
  await this.service.update(this.state.selectedSearchGroupItem.id!, {
372
- theme_model: saveParams,
423
+ searchGroupData: saveParams,
373
424
  show: this.state.selectedSearchGroupItem.show,
425
+ order: this.state.selectedSearchGroupItem.order,
374
426
  });
375
427
  ibiz.message.success('保存成功');
376
428
  } else {
@@ -404,6 +456,7 @@ export class SearchBarController
404
456
  const res = await this.service.get(groupItem.id!);
405
457
  if (res.ok) {
406
458
  mergeInLeft(groupItem, res.data);
459
+ groupItem.show = true;
407
460
  }
408
461
  }
409
462
  if (groupItem.searchGroupData && groupItem.searchGroupData.filternodes) {
@@ -114,31 +114,46 @@ export class SearchBarService {
114
114
  return res;
115
115
  }
116
116
 
117
+ /**
118
+ * 批量新建
119
+ * @param {IData} data
120
+ * @return {*}
121
+ * @author: zhujiamin
122
+ * @Date: 2023-12-26 15:49:00
123
+ */
124
+ async createBatch(data: IData[]): Promise<IHttpResponse> {
125
+ const createParams = this.convertFrontDataToBack(data);
126
+ const res = await this.app.net.post(`${this.themeUrl}`, createParams);
127
+ return res;
128
+ }
129
+
117
130
  /**
118
131
  * 更新数据
119
132
  *
120
133
  */
121
134
  async update(id: string, data: IData): Promise<IHttpResponse> {
122
- const updateParams = { app_view_tag: this.viewTag };
123
- if (data.theme_model) {
124
- Object.assign(updateParams, {
125
- theme_model: JSON.stringify(data.theme_model),
126
- });
127
- }
128
- if (data.caption) {
129
- Object.assign(updateParams, {
130
- name: data.caption,
131
- });
132
- }
133
- if (typeof data.show === 'boolean') {
134
- Object.assign(updateParams, {
135
- show: data.show,
136
- });
137
- }
135
+ const [updateParams] = this.convertFrontDataToBack([data]);
138
136
  const res = await this.app.net.put(`${this.themeUrl}/${id}`, updateParams);
139
137
  return res;
140
138
  }
141
139
 
140
+ /**
141
+ * 批量更新数据
142
+ * @param {IData} data
143
+ * @return {*}
144
+ * @author: zhujiamin
145
+ * @Date: 2023-12-26 11:11:34
146
+ */
147
+ async updateBatch(data: IData[]): Promise<IHttpResponse> {
148
+ const updateParams = this.convertFrontDataToBack(data);
149
+ const idUrl = updateParams.map(item => item.id).join(';');
150
+ const res = await this.app.net.put(
151
+ `${this.themeUrl}/${idUrl}`,
152
+ updateParams,
153
+ );
154
+ return res;
155
+ }
156
+
142
157
  /**
143
158
  * 转换后台数据成前端需要的格式
144
159
  * @param {IData} data
@@ -155,6 +170,45 @@ export class SearchBarService {
155
170
  if (item.theme_model) {
156
171
  tempItem.searchGroupData = JSON.parse(item.theme_model);
157
172
  }
173
+ if (typeof item.valid_flag === 'number') {
174
+ tempItem.show = item.valid_flag === 1;
175
+ }
176
+ if (item.order_value) {
177
+ tempItem.order = item.order_value;
178
+ }
179
+ return tempItem;
180
+ });
181
+ }
182
+
183
+ /**
184
+ * 转换前端数据成后台需要的格式
185
+ * @param {IData} data
186
+ * @return {*}
187
+ * @author: zhujiamin
188
+ * @Date: 2023-12-22 11:19:50
189
+ */
190
+ convertFrontDataToBack(data: IData[]): IData[] {
191
+ return data.map(item => {
192
+ const tempItem: IData = {
193
+ appId: item.appId,
194
+ app_view_tag: this.viewTag,
195
+ id: item.id,
196
+ };
197
+ if (item.caption) {
198
+ tempItem.name = item.caption;
199
+ }
200
+ if (
201
+ item.searchGroupData &&
202
+ Object.keys(item.searchGroupData).length > 0
203
+ ) {
204
+ tempItem.theme_model = JSON.stringify(item.searchGroupData);
205
+ }
206
+ if (typeof item.show === 'boolean') {
207
+ tempItem.valid_flag = item.show ? 1 : 0;
208
+ }
209
+ if (item.order) {
210
+ tempItem.order_value = item.order;
211
+ }
158
212
  return tempItem;
159
213
  });
160
214
  }
@@ -1,6 +1,4 @@
1
- import { IGanttNodeData } from '../../state';
2
- import { EventBase } from '../argument';
3
- import { IMDControlEvent } from './i-md-control.event';
1
+ import { ITreeGridExEvent } from './i-tree-grid-ex.event';
4
2
 
5
3
  /**
6
4
  * 甘特图事件
@@ -11,38 +9,4 @@ import { IMDControlEvent } from './i-md-control.event';
11
9
  * @interface IGanttEvent
12
10
  * @extends {IMDControlEvent}
13
11
  */
14
- export interface IGanttEvent extends IMDControlEvent {
15
- /**
16
- * 数据激活事件
17
- *
18
- * @type {({
19
- * event: EventBase & { nodeData: IGanttNodeData };
20
- * emitArgs: { data: IData[]; nodeData: IGanttNodeData };
21
- * })}
22
- * @memberof IGanttEvent
23
- */
24
- onActive: {
25
- event: EventBase & { nodeData: IGanttNodeData };
26
- emitArgs: { data: IData[]; nodeData: IGanttNodeData };
27
- };
28
-
29
- /**
30
- * 父节点刷新结束之后事件
31
- *
32
- * @type {({
33
- * event: EventBase & {
34
- * parentNode: IGanttNodeData;
35
- * children: IGanttNodeData[];
36
- * };
37
- * emitArgs: { parentNode: IGanttNodeData; children: IGanttNodeData[] };
38
- * })}
39
- * @memberof IGanttEvent
40
- */
41
- onAfterRefreshParent: {
42
- event: EventBase & {
43
- parentNode: IGanttNodeData;
44
- children: IGanttNodeData[];
45
- };
46
- emitArgs: { parentNode: IGanttNodeData; children: IGanttNodeData[] };
47
- };
48
- }
12
+ export interface IGanttEvent extends ITreeGridExEvent {}
@@ -1,5 +1,4 @@
1
- import { IColumnState } from './i-grid.state';
2
- import { IMDControlState } from './i-md-control.state';
1
+ import { ITreeGridExState } from './i-tree-grid-ex.state';
3
2
  import { ITreeNodeData } from './i-tree.state';
4
3
 
5
4
  /**
@@ -11,43 +10,7 @@ import { ITreeNodeData } from './i-tree.state';
11
10
  * @interface IGanttState
12
11
  * @extends {ITreeState}
13
12
  */
14
- export interface IGanttState extends IMDControlState {
15
- items: IGanttNodeData[];
16
-
17
- /**
18
- * 表格列状态数组
19
- *
20
- * @type {IColumnState[]}
21
- * @memberof IGanttState
22
- */
23
- columnStates: IColumnState[];
24
-
25
- /**
26
- * 树的根节点
27
- *
28
- * @type {IGanttNodeData}
29
- * @memberof IGanttState
30
- */
31
- rootNodes: IGanttNodeData[];
32
-
33
- /**
34
- * 查询条件
35
- *
36
- * @author tony001
37
- * @date 2023-12-11 18:12:20
38
- * @type {string}
39
- */
40
- query: string;
41
-
42
- /**
43
- * 快速搜索占位符
44
- *
45
- * @author tony001
46
- * @date 2023-12-11 18:12:29
47
- * @type {string}
48
- */
49
- placeHolder: string;
50
-
13
+ export interface IGanttState extends ITreeGridExState {
51
14
  /**
52
15
  * 甘特图样式
53
16
  *
@@ -154,12 +117,4 @@ export interface IGanttNodeData extends ITreeNodeData {
154
117
  * @memberof IGanttNodeData
155
118
  */
156
119
  parent?: IGanttNodeData;
157
-
158
- /**
159
- * 节点数据项
160
- *
161
- * @type {IData}
162
- * @memberof IGanttNodeData
163
- */
164
- nodeDataItem?: IData;
165
120
  }
@@ -151,7 +151,7 @@ export interface ISearchGroupData {
151
151
  searchconds?: IData;
152
152
 
153
153
  /**
154
- * 表格排序
154
+ * 表格排序查询条件
155
155
  */
156
156
  sort?: string;
157
157
  }
@@ -177,6 +177,14 @@ export interface IBackendSearchBarGroup extends ISearchBarGroup {
177
177
  */
178
178
  show: boolean;
179
179
 
180
+ /**
181
+ * 分组排序值
182
+ * @return {*}
183
+ * @author: zhujiamin
184
+ * @Date: 2023-12-26 11:21:02
185
+ */
186
+ order: number;
187
+
180
188
  /**
181
189
  * 搜索分组数据
182
190
  * @return {*}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * 父数据关系配置,用在数据域当中计算实体的父数据关系
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-12-26 15:12:59
6
+ * @export
7
+ * @interface IParentConfig
8
+ */
9
+ export interface IParentConfig {
10
+ /**
11
+ * 主实体代码标识
12
+ *
13
+ * @author chitanda
14
+ * @date 2023-12-26 15:12:08
15
+ * @type {string}
16
+ */
17
+ majorDECodeName: string;
18
+ /**
19
+ * 主实体代码标识2
20
+ *
21
+ * @author chitanda
22
+ * @date 2023-12-26 15:12:03
23
+ * @type {string}
24
+ */
25
+ majorDECodeName2: string;
26
+ /**
27
+ * 主实体名称
28
+ *
29
+ * @author chitanda
30
+ * @date 2023-12-26 15:12:57
31
+ * @type {string}
32
+ */
33
+ majorDEName: string;
34
+ /**
35
+ * 从实体代码标识
36
+ *
37
+ * @author chitanda
38
+ * @date 2023-12-26 15:12:52
39
+ * @type {string}
40
+ */
41
+ minorDECodeName: string;
42
+ /**
43
+ * 从实体代码标识2
44
+ *
45
+ * @author chitanda
46
+ * @date 2023-12-26 15:12:46
47
+ * @type {string}
48
+ */
49
+ minorDECodeName2: string;
50
+ /**
51
+ * 从实体名称
52
+ *
53
+ * @author chitanda
54
+ * @date 2023-12-26 15:12:41
55
+ * @type {string}
56
+ */
57
+ minorDEName: string;
58
+ /**
59
+ * 关系属性名称
60
+ *
61
+ * @author chitanda
62
+ * @date 2023-12-26 15:12:29
63
+ * @type {string}
64
+ */
65
+ pickupDEFName: string;
66
+ }
@@ -1,3 +1,4 @@
1
1
  export type { CodeListItem } from './code-list-item/code-list-item';
2
2
  export type { IDataEntity } from './i-data-entity/i-data-entity';
3
+ export type { IParentConfig } from './i-parent-config/i-parent-config';
3
4
  export type * from './service';
@@ -7,6 +7,25 @@
7
7
  * @interface IAuthService
8
8
  */
9
9
  export interface IAuthService {
10
+ /**
11
+ * 是否匿名登录
12
+ *
13
+ * @default false
14
+ * @author chitanda
15
+ * @date 2023-12-27 14:12:44
16
+ * @type {boolean}
17
+ */
18
+ isAnonymous: boolean;
19
+
20
+ /**
21
+ * 使用匿名账号登录
22
+ *
23
+ * @author chitanda
24
+ * @date 2023-12-27 14:12:49
25
+ * @return {*} {Promise<boolean>}
26
+ */
27
+ anonymousLogin(): Promise<boolean>;
28
+
10
29
  /**
11
30
  * 登录
12
31
  *
@@ -27,6 +27,16 @@ export class MethodDto {
27
27
 
28
28
  protected dtoMap: Map<string, MethodDto> = new Map();
29
29
 
30
+ /**
31
+ * 当前 DTO 是否已经计算过关系相关逻辑
32
+ *
33
+ * @link this.calcRs
34
+ * @author chitanda
35
+ * @date 2023-12-26 16:12:18
36
+ * @protected
37
+ */
38
+ protected isCalcRs = false;
39
+
30
40
  constructor(
31
41
  protected service: IAppDEService,
32
42
  protected entity: IAppDataEntity,
@@ -92,8 +102,13 @@ export class MethodDto {
92
102
  * @param {IData} data
93
103
  * @return {*} {Promise<IData>}
94
104
  */
95
- async get(context: IContext, data: IData): Promise<IData> {
105
+ async get(
106
+ context: IContext,
107
+ data: IData,
108
+ ignore: boolean = false,
109
+ ): Promise<IData> {
96
110
  const params: IData = {};
111
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
97
112
  // 拷贝数据
98
113
  for (let i = 0; i < this.fields.length; i++) {
99
114
  const field = this.fields[i];
@@ -113,24 +128,39 @@ export class MethodDto {
113
128
  : this.convertArrayToListMap(data[key]);
114
129
  }
115
130
  } else {
116
- if (data[key] !== undefined) {
131
+ if (data[key] !== undefined && ignore === false) {
117
132
  break;
118
133
  }
119
134
  // 没有实体id的不处理
120
135
  if (!field.refAppDataEntityId) {
121
136
  break;
122
137
  }
138
+
139
+ // 获取当前需要打包子数据的关系配置
140
+ let configs = uiDomain.getDERConfig(field.refAppDataEntityId!);
141
+ // 找到当前层级所在下标
142
+ const index = configs.findIndex(
143
+ config => config.majorDECodeName === this.entity.codeName,
144
+ );
145
+ // 过滤出当前层级之后的关系配置
146
+ configs = configs.slice(index + 1);
147
+
123
148
  const dto = await this.getFieldDto(context, field);
124
149
  // 子数据过滤参数
125
150
  const filterParams: IParams = {};
126
151
  if (field.refPickupAppDEFieldId) {
127
152
  filterParams[field.refPickupAppDEFieldId!] = data.srfkey;
128
153
  }
154
+ // 子层级数据过滤参数对象必须为空
155
+ configs.forEach(config => {
156
+ filterParams[config.pickupDEFName.toLowerCase()] = null;
157
+ });
158
+
129
159
  const items = await dto.select(context, filterParams);
130
160
  if (items) {
131
161
  const arr = [];
132
162
  for (let j = 0; j < items.length; j++) {
133
- arr.push(await dto.get(context, items[j]));
163
+ arr.push(await dto.get(context, items[j], true));
134
164
  }
135
165
  params[key] = arr;
136
166
  }
@@ -161,6 +191,7 @@ export class MethodDto {
161
191
  if (this.isLocalMode) {
162
192
  this.service.local.clear();
163
193
  }
194
+ await this.calcRs(context);
164
195
  return Promise.all(
165
196
  data.map(async datum => {
166
197
  const all = this.fields
@@ -183,6 +214,7 @@ export class MethodDto {
183
214
  item[field.refPickupAppDEFieldId!] = pKey;
184
215
  });
185
216
  await dto.sets(context, items);
217
+ // 删除下边一行代码,DTO 的属性也不能直接删除。界面上表单类似重复器的地方会用到,保存时也需要由界面提供
186
218
  delete datum[key];
187
219
  } else {
188
220
  await dto.sets(context, []);
@@ -201,6 +233,51 @@ export class MethodDto {
201
233
  );
202
234
  }
203
235
 
236
+ /**
237
+ * 递归计算当前 DTO 相关实体的父关系配置
238
+ *
239
+ * @author chitanda
240
+ * @date 2023-12-26 16:12:13
241
+ * @protected
242
+ * @param {IContext} context
243
+ * @param {number} [depth=0] 递归层级,避免进入死循环。最大递归层级为 10
244
+ * @return {*} {Promise<void>}
245
+ */
246
+ protected async calcRs(context: IContext, depth: number = 0): Promise<void> {
247
+ if (this.isCalcRs || depth > 10) {
248
+ return;
249
+ }
250
+ this.isCalcRs = true;
251
+ depth += 1;
252
+
253
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
254
+ const dtoFields = this.fields.filter(field => field.type === 'DTOS');
255
+
256
+ for (let i = 0; i < dtoFields.length; i++) {
257
+ const field = dtoFields[i];
258
+ if (!field.refAppDataEntityId) {
259
+ continue;
260
+ }
261
+ const configs = uiDomain.getDERConfig(field.refAppDataEntityId!);
262
+ const index = configs.findIndex(
263
+ config => config.pickupDEFName === field.refPickupAppDEFieldId!,
264
+ );
265
+ if (index === -1) {
266
+ const dto = await this.getFieldDto(context, field);
267
+ uiDomain.setDERConfig(field.refAppDataEntityId!, {
268
+ majorDEName: this.entity.name!,
269
+ majorDECodeName: this.entity.codeName!,
270
+ majorDECodeName2: this.entity.codeName2!,
271
+ minorDEName: dto.entity.name!,
272
+ minorDECodeName: dto.entity.codeName!,
273
+ minorDECodeName2: dto.entity.codeName2!,
274
+ pickupDEFName: field.refPickupAppDEFieldId!,
275
+ });
276
+ await dto.calcRs(context, depth);
277
+ }
278
+ }
279
+ }
280
+
204
281
  /**
205
282
  * 获取子属性 DTO
206
283
  *
@@ -11,6 +11,21 @@ import { IAuthService } from '../../../interface';
11
11
  * @class AuthService
12
12
  */
13
13
  export class V7AuthService implements IAuthService {
14
+ isAnonymous = false;
15
+
16
+ async anonymousLogin(): Promise<boolean> {
17
+ const { anonymousUser, anonymousPwd } = ibiz.env;
18
+ if (!anonymousUser || !anonymousPwd) {
19
+ ibiz.log.error(`未找到匿名登录配置用户名或密码`);
20
+ return false;
21
+ }
22
+ const result = await this.login(anonymousUser, anonymousPwd);
23
+ if (result) {
24
+ this.isAnonymous = true;
25
+ }
26
+ return result;
27
+ }
28
+
14
29
  async login(
15
30
  loginName: string,
16
31
  password: string,
@@ -1,7 +1,7 @@
1
1
  import { IDEGantt, IDETreeDataSetNode } from '@ibiz/model-core';
2
2
  import { IGanttNodeData } from '../../../interface';
3
3
  import { TreeDataSetNodeData } from '../tree-node-data';
4
- import { calcDataItemValue, calcNodeDataItem } from './gantt-node-data-util';
4
+ import { calcDataItemValue } from './gantt-node-data-util';
5
5
 
6
6
  export class GanttDataSetNodeData
7
7
  extends TreeDataSetNodeData
@@ -23,8 +23,6 @@ export class GanttDataSetNodeData
23
23
 
24
24
  parent?: IGanttNodeData;
25
25
 
26
- nodeDataItem: IData;
27
-
28
26
  constructor(
29
27
  model: IDEGantt,
30
28
  nodeModel: IDETreeDataSetNode,
@@ -68,6 +66,5 @@ export class GanttDataSetNodeData
68
66
  nodeModel,
69
67
  data,
70
68
  );
71
- this.nodeDataItem = calcNodeDataItem(nodeModel, data);
72
69
  }
73
70
  }
@@ -24,24 +24,3 @@ export const calcDataItemValue = (
24
24
  }
25
25
  return result;
26
26
  };
27
-
28
- /**
29
- * 计算数据项
30
- * @param nodeModel 节点模型
31
- * @param data 数据
32
- * @returns
33
- */
34
- export const calcNodeDataItem = (
35
- nodeModel: IDETreeNode,
36
- data: IData,
37
- ): IData => {
38
- const dataItem: IData = {};
39
- nodeModel.detreeNodeDataItems?.forEach(item => {
40
- if (item.id && item.appDEFieldId) {
41
- Object.assign(dataItem, {
42
- [item.id.toLowerCase()]: data[item.appDEFieldId.toLowerCase()],
43
- });
44
- }
45
- });
46
- return dataItem;
47
- };