@ibiz-template/runtime 0.3.1 → 0.3.3

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 (93) hide show
  1. package/dist/index.esm.js +603 -278
  2. package/dist/index.system.min.js +2 -2
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/app-hub.d.ts +5 -5
  5. package/out/app-hub.d.ts.map +1 -1
  6. package/out/app-hub.js +2 -2
  7. package/out/config/global-config.d.ts.map +1 -1
  8. package/out/config/global-config.js +1 -0
  9. package/out/constant/sys-uiaction-tag.d.ts +4 -0
  10. package/out/constant/sys-uiaction-tag.d.ts.map +1 -1
  11. package/out/constant/sys-uiaction-tag.js +4 -0
  12. package/out/controller/common/control/control.controller.js +2 -2
  13. package/out/controller/control/app-menu/app-menu.controller.d.ts +2 -3
  14. package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
  15. package/out/controller/control/form/edit-form/edit-form.service.js +1 -1
  16. package/out/controller/control/form/form-detail/form-item/form-item.controller.js +1 -1
  17. package/out/controller/control/form/search-form/search-form.controller.d.ts +9 -0
  18. package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
  19. package/out/controller/control/form/search-form/search-form.controller.js +59 -0
  20. package/out/controller/control/grid/grid/grid.controller.d.ts +31 -2
  21. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  22. package/out/controller/control/grid/grid/grid.controller.js +83 -21
  23. package/out/controller/control/panel/panel/panel.controller.d.ts +4 -1
  24. package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
  25. package/out/controller/control/panel/panel/panel.controller.js +17 -16
  26. package/out/controller/utils/data-file-util/data-file-util.d.ts +3 -3
  27. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
  28. package/out/controller/utils/data-file-util/data-file-util.js +10 -4
  29. package/out/engine/md-view.engine.d.ts.map +1 -1
  30. package/out/engine/md-view.engine.js +8 -0
  31. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +5 -5
  32. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  33. package/out/interface/common/i-app-service/i-app-service.d.ts +53 -0
  34. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  35. package/out/interface/common/i-global-config/i-global-grid-config.d.ts +9 -0
  36. package/out/interface/common/i-global-config/i-global-grid-config.d.ts.map +1 -1
  37. package/out/interface/controller/controller/control/i-grid.controller.d.ts +27 -1
  38. package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
  39. package/out/interface/controller/controller/control/i-panel.controller.d.ts +8 -0
  40. package/out/interface/controller/controller/control/i-panel.controller.d.ts.map +1 -1
  41. package/out/interface/service/service/i-app-de.service.d.ts +66 -0
  42. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  43. package/out/model/utils/util.d.ts +5 -5
  44. package/out/model/utils/util.d.ts.map +1 -1
  45. package/out/model/utils/util.js +16 -8
  46. package/out/service/dto/method.dto.d.ts +2 -2
  47. package/out/service/dto/method.dto.d.ts.map +1 -1
  48. package/out/service/dto/method.dto.js +3 -1
  49. package/out/service/service/config/config.service.d.ts.map +1 -1
  50. package/out/service/service/control/control.service.d.ts +2 -2
  51. package/out/service/service/control/control.service.d.ts.map +1 -1
  52. package/out/service/service/entity/de.service.d.ts +6 -0
  53. package/out/service/service/entity/de.service.d.ts.map +1 -1
  54. package/out/service/service/entity/de.service.js +18 -0
  55. package/out/service/service/entity/method/method.d.ts +2 -3
  56. package/out/service/service/entity/method/method.d.ts.map +1 -1
  57. package/out/service/service/work-flow/work-flow.service.d.ts.map +1 -1
  58. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  59. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +5 -0
  60. package/out/ui-action/provider/front-ui-action-provider.d.ts +24 -0
  61. package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
  62. package/out/ui-action/provider/front-ui-action-provider.js +128 -1
  63. package/out/ui-action/provider/sys-ui-action-provider.d.ts.map +1 -1
  64. package/out/ui-action/provider/sys-ui-action-provider.js +2 -0
  65. package/package.json +3 -3
  66. package/src/app-hub.ts +5 -5
  67. package/src/config/global-config.ts +1 -0
  68. package/src/constant/sys-uiaction-tag.ts +4 -0
  69. package/src/controller/common/control/control.controller.ts +2 -2
  70. package/src/controller/control/app-menu/app-menu.controller.ts +2 -2
  71. package/src/controller/control/form/edit-form/edit-form.service.ts +1 -1
  72. package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +1 -1
  73. package/src/controller/control/form/search-form/search-form.controller.ts +64 -0
  74. package/src/controller/control/grid/grid/grid.controller.ts +121 -27
  75. package/src/controller/control/panel/panel/panel.controller.ts +15 -0
  76. package/src/controller/utils/data-file-util/data-file-util.ts +11 -3
  77. package/src/engine/md-view.engine.ts +8 -0
  78. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +5 -5
  79. package/src/interface/common/i-app-service/i-app-service.ts +71 -0
  80. package/src/interface/common/i-global-config/i-global-grid-config.ts +10 -0
  81. package/src/interface/controller/controller/control/i-grid.controller.ts +30 -1
  82. package/src/interface/controller/controller/control/i-panel.controller.ts +9 -0
  83. package/src/interface/service/service/i-app-de.service.ts +96 -0
  84. package/src/model/utils/util.ts +18 -8
  85. package/src/service/dto/method.dto.ts +5 -3
  86. package/src/service/service/config/config.service.ts +2 -3
  87. package/src/service/service/control/control.service.ts +2 -2
  88. package/src/service/service/entity/de.service.ts +48 -0
  89. package/src/service/service/entity/method/method.ts +2 -3
  90. package/src/service/service/work-flow/work-flow.service.ts +2 -3
  91. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +7 -1
  92. package/src/ui-action/provider/front-ui-action-provider.ts +153 -1
  93. package/src/ui-action/provider/sys-ui-action-provider.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"front-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/front-ui-action-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAa,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAc,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,oBAAoB;IACvD,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;IAuD3B;;;;;;;;OAQG;IAEH,SAAS,CAAC,OAAO,CACf,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,eAAe;CAYnB"}
1
+ {"version":3,"file":"front-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/front-ui-action-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAa,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAc,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,oBAAoB;IACvD,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;IAgE3B;;;;;;;;OAQG;IAEH,SAAS,CAAC,OAAO,CACf,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,eAAe;IAalB;;;;;;OAMG;cACa,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC;IAiChB;;;;;;OAMG;cACa,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC;IA8B3B;;;;;;OAMG;cACa,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,IAAI,CAAC;CA4CjB"}
@@ -1,4 +1,4 @@
1
- import { StringUtil, RuntimeModelError, ModelError } from '@ibiz-template/core';
1
+ import { StringUtil, RuntimeModelError, ModelError, RuntimeError, } from '@ibiz-template/core';
2
2
  import { OpenAppViewCommand } from '../../command';
3
3
  import { ScriptFactory } from '../../utils';
4
4
  import { UIActionProviderBase } from './ui-action-provider-base';
@@ -42,6 +42,15 @@ export class FrontUIActionProvider extends UIActionProviderBase {
42
42
  }
43
43
  break;
44
44
  }
45
+ case 'PRINT':
46
+ await this.executePrint(action, args);
47
+ break;
48
+ case 'DATAIMP':
49
+ actionResult = await this.executeDataImport(action, args);
50
+ break;
51
+ case 'DATAEXP':
52
+ await this.executeDataExport(action, args);
53
+ break;
45
54
  case 'OTHER':
46
55
  actionResult = this.doOther(action, args);
47
56
  break;
@@ -69,4 +78,122 @@ export class FrontUIActionProvider extends UIActionProviderBase {
69
78
  }
70
79
  throw new RuntimeModelError(action, '自定义类型缺少配置脚本代码');
71
80
  }
81
+ /**
82
+ * 执行打印行为
83
+ * @protected
84
+ * @param {IAppDEUIAction} action
85
+ * @param {IUILogicParams} args
86
+ * @return {*}
87
+ */
88
+ async executePrint(action, args) {
89
+ var _a, _b;
90
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
91
+ const appDEPrint = (_a = appDataEntity.appDEPrints) === null || _a === void 0 ? void 0 : _a.find(print => {
92
+ return print.id === action.appDEPrintId;
93
+ });
94
+ if (appDEPrint) {
95
+ let requestUrl = '';
96
+ const { context } = args;
97
+ if (context && context[appDataEntity.codeName.toLowerCase()]) {
98
+ // TODO 临时写死printdata, 非标准,后续优化
99
+ requestUrl += `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/printdata/${context[appDataEntity.codeName.toLowerCase()]}?srfprinttag=${appDEPrint.codeName}`;
100
+ }
101
+ else {
102
+ throw new RuntimeError('没有找到数据主键');
103
+ }
104
+ const res = await ibiz.net.request(requestUrl, {
105
+ method: 'get',
106
+ responseType: 'blob',
107
+ });
108
+ if (res.ok) {
109
+ const link = window.URL.createObjectURL(res.data);
110
+ window.open(link, '_blank');
111
+ }
112
+ else {
113
+ throw new RuntimeError('打印失败');
114
+ }
115
+ }
116
+ else {
117
+ throw new RuntimeError('没有找到实体打印项');
118
+ }
119
+ }
120
+ /**
121
+ * 执行导入行为
122
+ * @protected
123
+ * @param {IAppDEUIAction} action
124
+ * @param {IUILogicParams} args
125
+ * @return {*}
126
+ */
127
+ async executeDataImport(action, _args) {
128
+ var _a;
129
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
130
+ const appDEDataImport = (_a = appDataEntity.appDEDataImports) === null || _a === void 0 ? void 0 : _a.find(dataImport => dataImport.id === action.appDEDataImportId);
131
+ if (appDEDataImport) {
132
+ const modal = ibiz.overlay.createModal('DataImport', {
133
+ dismiss: () => modal.dismiss(),
134
+ appDataEntity,
135
+ dataImport: appDEDataImport,
136
+ }, {
137
+ width: 'auto',
138
+ placement: 'center',
139
+ });
140
+ modal.present();
141
+ await modal.onWillDismiss();
142
+ return {
143
+ refresh: true,
144
+ refreshMode: 1,
145
+ };
146
+ }
147
+ throw new RuntimeError('没有找到实体导入项');
148
+ }
149
+ /**
150
+ * 执行导出行为
151
+ * @protected
152
+ * @param {IAppDEUIAction} action
153
+ * @param {IUILogicParams} args
154
+ * @return {*}
155
+ */
156
+ async executeDataExport(action, _args) {
157
+ var _a, _b;
158
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
159
+ const appDEDataExport = (_a = appDataEntity.appDEDataExports) === null || _a === void 0 ? void 0 : _a.find(dataExport => {
160
+ return dataExport.id === action.appDEDataExportId;
161
+ });
162
+ if (appDEDataExport) {
163
+ // TODO 临时写死fetchdefault,应该从appDEDataExport的主表格上获取加载行为,但现在缺主表格模型,后续优化
164
+ const url = `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/exportdata/fetchdefault?srfexporttag=${appDEDataExport.codeName}`;
165
+ // 参数
166
+ const params = {
167
+ page: 0,
168
+ size: appDEDataExport.maxRowCount ? appDEDataExport.maxRowCount : 1000,
169
+ responseType: 'blob',
170
+ };
171
+ const res = await ibiz.net.request(url, {
172
+ method: 'post',
173
+ data: params,
174
+ responseType: 'blob',
175
+ });
176
+ if (res.status === 200) {
177
+ let fileName = `${appDataEntity.logicName}表.xlsx`;
178
+ fileName = decodeURIComponent(fileName);
179
+ const blob = new Blob([res.data], {
180
+ type: 'application/vnd.ms-excel',
181
+ });
182
+ const elink = document.createElement('a');
183
+ elink.download = fileName;
184
+ elink.style.display = 'none';
185
+ elink.href = URL.createObjectURL(blob);
186
+ document.body.appendChild(elink);
187
+ elink.click();
188
+ URL.revokeObjectURL(elink.href); // 释放URL 对象
189
+ document.body.removeChild(elink);
190
+ }
191
+ else {
192
+ throw new RuntimeError('导出请求失败');
193
+ }
194
+ }
195
+ else {
196
+ throw new RuntimeError('没有找到实体导出项');
197
+ }
198
+ }
72
199
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sys-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/sys-ui-action-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,oBAAoB;IAC3D,OAAO,CAAC,mBAAmB,CAoCxB;IAEG,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;CAc5B"}
1
+ {"version":3,"file":"sys-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/sys-ui-action-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,oBAAoB;IAC3D,OAAO,CAAC,mBAAmB,CAsCxB;IAEG,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;CAc5B"}
@@ -48,6 +48,8 @@ export class SysUIActionProvider extends UIActionProviderBase {
48
48
  ['GRIDVIEW_SAVEROWACTION', 'SaveRow'],
49
49
  ['APP_LOGIN', 'Login'],
50
50
  ['APP_LOGOUT', 'logout'],
51
+ ['UTIL_RESET', 'Reset'],
52
+ ['UTIL_SEARCH', 'Search'],
51
53
  ]);
52
54
  }
53
55
  async execAction(action, args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -46,7 +46,7 @@
46
46
  "ramda": "^0.29.1"
47
47
  },
48
48
  "peerDependencies": {
49
- "@ibiz-template/core": "^0.2.13",
49
+ "@ibiz-template/core": "^0.3.0",
50
50
  "@ibiz/model-core": "^0.0.20",
51
51
  "async-validator": "^4.2.5",
52
52
  "dayjs": "^1.11.7",
@@ -59,5 +59,5 @@
59
59
  "qx-util": "^0.4.8",
60
60
  "ramda": "^0.29.0"
61
61
  },
62
- "gitHead": "2827c2bd507c4ab3efafa7ebb4990c18e198823a"
62
+ "gitHead": "7f8e0137d5d235f6eebab383f046dd91a22ce94c"
63
63
  }
package/src/app-hub.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IAppDataEntity, IAppView, IApplication } from '@ibiz/model-core';
2
2
  import { RuntimeError } from '@ibiz-template/core';
3
3
  import { Application } from './application';
4
- import { IAppHubService, ModelLoaderProvider } from './interface';
4
+ import { IAppHubService, IAppService, ModelLoaderProvider } from './interface';
5
5
  import { AppConfigService, Convert } from './hub';
6
6
  import { HubController } from './controller';
7
7
  import { ConfigService } from './service';
@@ -329,9 +329,9 @@ export class AppHub implements IAppHubService {
329
329
  * @author chitanda
330
330
  * @date 2023-04-17 21:04:41
331
331
  * @param {string} [key=ibiz.env.appId]
332
- * @return {*} {Promise<Application>}
332
+ * @return {*} {Promise<IAppService>}
333
333
  */
334
- async getAppAsync(key: string = ibiz.env.appId): Promise<Application> {
334
+ async getAppAsync(key: string = ibiz.env.appId): Promise<IAppService> {
335
335
  return this.createApp(key);
336
336
  }
337
337
 
@@ -341,9 +341,9 @@ export class AppHub implements IAppHubService {
341
341
  * @author chitanda
342
342
  * @date 2023-04-17 22:04:42
343
343
  * @param {(string | IApplication)} [app]
344
- * @return {*} {Application}
344
+ * @return {*} {IAppService}
345
345
  */
346
- getApp(app?: string | IApplication): Application {
346
+ getApp(app?: string | IApplication): IAppService {
347
347
  let key: string | null = null;
348
348
  if (app) {
349
349
  if (app instanceof Object) {
@@ -26,6 +26,7 @@ export class GlobalConfig implements IGlobalConfig {
26
26
  grid: IGlobalGridConfig = {
27
27
  editShowMode: 'row',
28
28
  editSaveMode: 'cell-blur',
29
+ overflowMode: 'wrap',
29
30
  };
30
31
 
31
32
  // 全局菜单配置
@@ -91,6 +91,10 @@ export enum SysUIActionTag {
91
91
  * 搜索
92
92
  */
93
93
  'SEARCH' = 'Search',
94
+ /**
95
+ * 重置
96
+ */
97
+ 'RESET' = 'Reset',
94
98
  /**
95
99
  * 完成
96
100
  */
@@ -5,7 +5,7 @@ import {
5
5
  IViewLayoutPanel,
6
6
  } from '@ibiz/model-core';
7
7
  import { IBizContext, IBizParams, NoticeError } from '@ibiz-template/core';
8
- import { isNil } from 'ramda';
8
+ import { clone, isNil } from 'ramda';
9
9
  import { notNilEmpty } from 'qx-util';
10
10
  import { BaseController } from '..';
11
11
  import { CTX } from '../../ctx';
@@ -110,7 +110,7 @@ export class ControlController<
110
110
  `${model.controlType}_DEFAULT`,
111
111
  );
112
112
  if (panelModel) {
113
- this.controlPanel = panelModel;
113
+ this.controlPanel = clone(panelModel);
114
114
  }
115
115
 
116
116
  this.updateContextParams({});
@@ -4,12 +4,12 @@ import {
4
4
  RuntimeModelError,
5
5
  } from '@ibiz-template/core';
6
6
  import { IAppMenu, IAppMenuItem } from '@ibiz/model-core';
7
- import { Application } from '../../../application';
8
7
  import { AppFuncCommand } from '../../../command';
9
8
  import {
10
9
  IAppMenuState,
11
10
  IAppMenuEvent,
12
11
  IAppMenuController,
12
+ IAppService,
13
13
  } from '../../../interface';
14
14
  import { AppCounter } from '../../../service';
15
15
  import { ControlController } from '../../common';
@@ -27,7 +27,7 @@ export class AppMenuController
27
27
  extends ControlController<IAppMenu, IAppMenuState, IAppMenuEvent>
28
28
  implements IAppMenuController
29
29
  {
30
- app!: Application;
30
+ app!: IAppService;
31
31
 
32
32
  protected initState(): void {
33
33
  super.initState();
@@ -266,7 +266,7 @@ export class EditFormService<
266
266
  (item: IDEFormDetail) => {
267
267
  if (item.detailType === 'FORMITEM' || item.detailType === 'MDCTRL') {
268
268
  const formItem = item as IDEEditFormItem;
269
- const uiKey = formItem.fieldName || formItem.id!.toLowerCase();
269
+ const uiKey = formItem.id!.toLowerCase();
270
270
  const deField =
271
271
  formItem.fieldName || (item as IDEEditFormItem).appDEFieldId!;
272
272
  let mapField: UIMapField;
@@ -95,7 +95,7 @@ export class FormItemController
95
95
  * @readonly
96
96
  */
97
97
  get name(): string {
98
- return this.model.fieldName || this.model.id!;
98
+ return this.model.id!;
99
99
  }
100
100
 
101
101
  /**
@@ -34,6 +34,7 @@ export class SearchFormController
34
34
 
35
35
  protected async onCreated(): Promise<void> {
36
36
  await super.onCreated();
37
+ this.preprocessLayoutPanel();
37
38
  // 实例部件服务
38
39
  this.service = new SearchFormService(this.model);
39
40
  await this.service.init(this.context);
@@ -159,4 +160,67 @@ export class SearchFormController
159
160
  await this.onSearchButtonClick();
160
161
  }
161
162
  }
163
+
164
+ /**
165
+ * 根据搜索表单的按钮位置和按钮样式
166
+ * 预处理部件布局面板模型
167
+ * @author lxm
168
+ * @date 2023-11-21 04:17:43
169
+ * @protected
170
+ * @return {*}
171
+ */
172
+ protected preprocessLayoutPanel(): void {
173
+ if (!this.controlPanel) {
174
+ return;
175
+ }
176
+ const { searchButtonStyle } = this.model;
177
+ let deleteRight = false;
178
+ let deleteBottom = false;
179
+ const searchButtonPos = this.model.searchButtonPos || 'RIGHT';
180
+ deleteRight = searchButtonPos === 'BOTTOM';
181
+ deleteBottom = searchButtonPos !== 'BOTTOM';
182
+
183
+ if (searchButtonStyle === 'NONE') {
184
+ deleteRight = true;
185
+ deleteBottom = true;
186
+ }
187
+
188
+ /**
189
+ * 递归面板项
190
+ * @author lxm
191
+ * @date 2023-11-21 04:16:36
192
+ * @param {IData} parent
193
+ */
194
+ const recursivePanelItems = (parent: IData): void => {
195
+ let children: IData[] | undefined;
196
+ let childrenKey = '';
197
+ ['rootPanelItems', 'panelItems'].find(key => {
198
+ if (parent[key]) {
199
+ children = parent[key];
200
+ childrenKey = key;
201
+ return true;
202
+ }
203
+ return false;
204
+ });
205
+ if (children && children.length > 0) {
206
+ const newArr: IData[] = [];
207
+ children.forEach((item: IData) => {
208
+ const isDelete =
209
+ (deleteRight && item.id === 'control_buttons_right') ||
210
+ (deleteBottom && item.id === 'control_buttons_bottom');
211
+ if (!isDelete) {
212
+ newArr.push(item);
213
+ recursivePanelItems(item);
214
+ }
215
+ });
216
+ if (newArr.length < children.length) {
217
+ parent[childrenKey] = newArr;
218
+ }
219
+ }
220
+ };
221
+
222
+ if (deleteBottom || deleteRight) {
223
+ recursivePanelItems(this.controlPanel);
224
+ }
225
+ }
162
226
  }
@@ -8,7 +8,12 @@ import {
8
8
  RuntimeError,
9
9
  RuntimeModelError,
10
10
  } from '@ibiz-template/core';
11
- import { IDEGrid, IDEGridGroupColumn, IDEGridColumn } from '@ibiz/model-core';
11
+ import {
12
+ IDEGrid,
13
+ IDEGridGroupColumn,
14
+ IDEGridColumn,
15
+ IDEDataExport,
16
+ } from '@ibiz/model-core';
12
17
  import { clone } from 'ramda';
13
18
  import { GridFieldColumnController } from '../grid-column/grid-field-column/grid-field-column.controller';
14
19
  import { GridColumnController } from './grid-column.controller';
@@ -26,6 +31,7 @@ import {
26
31
  CodeListItem,
27
32
  MDCtrlLoadParams,
28
33
  IGridRowState,
34
+ IExportColumn,
29
35
  } from '../../../../interface';
30
36
  import { calcDeCodeNameById } from '../../../../model';
31
37
  import { getGridColumnProvider } from '../../../../register';
@@ -134,6 +140,22 @@ export class GridController
134
140
  */
135
141
  aggTitle: string = '合计';
136
142
 
143
+ /**
144
+ * 数据导出对象
145
+ * @author lxm
146
+ * @date 2023-08-07 04:11:00
147
+ * @type {IDEDataExport}
148
+ */
149
+ dataExport: IDEDataExport | undefined;
150
+
151
+ /**
152
+ * 数据导出列
153
+ * @author lxm
154
+ * @date 2023-08-07 04:11:00
155
+ * @type {IDEDataExport}
156
+ */
157
+ allExportColumns: IExportColumn[] | undefined;
158
+
137
159
  /**
138
160
  * 分组代码表项集合
139
161
  * @author lxm
@@ -166,6 +188,17 @@ export class GridController
166
188
  return !!this.model.enableRowEdit && this.state.rowEditOpen;
167
189
  }
168
190
 
191
+ /**
192
+ * 单元格超出呈现模式
193
+ * @author lxm
194
+ * @date 2023-11-17 01:56:26
195
+ * @readonly
196
+ * @type {('wrap' | 'ellipsis')}
197
+ */
198
+ get overflowMode(): 'wrap' | 'ellipsis' {
199
+ return ibiz.config.grid.overflowMode;
200
+ }
201
+
169
202
  protected initState(): void {
170
203
  super.initState();
171
204
  this.state.rows = [];
@@ -902,6 +935,35 @@ export class GridController
902
935
  return res.data;
903
936
  }
904
937
 
938
+ /**
939
+ * 初始化数据导出列
940
+ * @return {*}
941
+ * @author: zhujiamin
942
+ * @Date: 2023-11-21 18:54:16
943
+ */
944
+ async findAllExportColumns(
945
+ dataExport: IDEDataExport,
946
+ ): Promise<IExportColumn[] | undefined> {
947
+ const app = ibiz.hub.getApp(this.context.srfappid);
948
+ const exportColumnsPromises: Promise<IExportColumn>[] | undefined =
949
+ dataExport.dedataExportItems?.map(async item => {
950
+ const tempExportColumn: IExportColumn = { ...item };
951
+ if (item.codeListId) {
952
+ // 加载代码表模型
953
+ tempExportColumn.codeList = app.codeList.getCodeList(item.codeListId);
954
+ tempExportColumn.codeListItems = await app.codeList.get(
955
+ item.codeListId,
956
+ );
957
+ }
958
+ return tempExportColumn;
959
+ });
960
+ // 使用 Promise.all 等待所有 Promise 解析
961
+ if (exportColumnsPromises) {
962
+ return Promise.all(exportColumnsPromises);
963
+ }
964
+ return undefined;
965
+ }
966
+
905
967
  /**
906
968
  * 数据导出
907
969
  *
@@ -910,35 +972,55 @@ export class GridController
910
972
  * @memberof MDControlController
911
973
  */
912
974
  async exportData(_args: { event: MouseEvent; params: IData }): Promise<void> {
913
- // 前台导出
914
- const items: { [key: string]: GridFieldColumnController } =
915
- this.fieldColumns;
975
+ // 初始化导出对象
976
+ if (this.model.dedataExportId && !this.dataExport) {
977
+ this.dataExport = this.dataEntity.appDEDataExports?.find(dataExport => {
978
+ return dataExport.id === this.model.dedataExportId;
979
+ });
980
+ if (this.dataExport) {
981
+ this.allExportColumns = await this.findAllExportColumns(
982
+ this.dataExport,
983
+ );
984
+ }
985
+ }
916
986
  // 数据格式化
917
987
  const formatExcelData = (data: IData[]): IData[] => {
918
- // const codeListMap: Map<string, readonly CodeListItem[]> = new Map();
919
- // Object.keys(items).forEach((key: string) => {
920
- // if (items[key].codeList) {
921
- // codeListMap.set(key, items[key].codeListItems!);
922
- // }
923
- // });
988
+ const codeListMap: Map<string, readonly CodeListItem[]> = new Map();
989
+ if (this.allExportColumns && this.allExportColumns.length > 0) {
990
+ this.allExportColumns?.forEach((exportColumn: IExportColumn) => {
991
+ if (exportColumn.codeListItems) {
992
+ codeListMap.set(
993
+ exportColumn.appDEFieldId!,
994
+ exportColumn.codeListItems!,
995
+ );
996
+ }
997
+ });
998
+ } else {
999
+ Object.keys(this.fieldColumns).forEach((key: string) => {
1000
+ if (this.fieldColumns[key].codeList) {
1001
+ codeListMap.set(key, this.fieldColumns[key].codeListItems!);
1002
+ }
1003
+ });
1004
+ }
924
1005
  const cloneData = clone(
925
1006
  data.map(item => {
926
1007
  return item.getOrigin();
927
1008
  }),
928
1009
  );
929
- // cloneData.forEach(item => {
930
- // const fields = Object.keys(item);
931
- // fields.forEach((key: string) => {
932
- // if (codeListMap.get(key)) {
933
- // item[key] =
934
- // codeListMap.get(key)!.find(_item => {
935
- // return _item.value === item[key];
936
- // })?.text || item[key];
937
- // }
938
- // });
939
- // });
1010
+ cloneData.forEach(item => {
1011
+ const fields = Object.keys(item);
1012
+ fields.forEach((key: string) => {
1013
+ if (codeListMap.get(key)) {
1014
+ item[key] =
1015
+ codeListMap.get(key)!.find(_item => {
1016
+ return _item.value === item[key];
1017
+ })?.text || item[key];
1018
+ }
1019
+ });
1020
+ });
940
1021
  return cloneData;
941
1022
  };
1023
+ // 获取导出数据
942
1024
  const getExportData = async (): Promise<IData[]> => {
943
1025
  const type = _args.params?.type;
944
1026
  let data: IData[] = [];
@@ -977,14 +1059,26 @@ export class GridController
977
1059
  });
978
1060
  });
979
1061
  };
1062
+
980
1063
  // 头部id数组
981
- const filterVal = Object.keys(items).map(
982
- (key: string) => items[key].model.id!,
983
- );
1064
+ let filterVal: string[] = [];
984
1065
  // 表头数组
985
- const header = Object.keys(items).map(
986
- (key: string) => items[key].model.caption!,
987
- );
1066
+ let header: string[] = [];
1067
+ if (this.allExportColumns && this.allExportColumns.length > 0) {
1068
+ filterVal = this.allExportColumns.map(
1069
+ (column: IExportColumn) => column.appDEFieldId!,
1070
+ );
1071
+ header = this.allExportColumns.map(
1072
+ (column: IExportColumn) => column.caption!,
1073
+ );
1074
+ } else {
1075
+ filterVal = Object.keys(this.fieldColumns).map(
1076
+ (key: string) => this.fieldColumns[key].model.id!,
1077
+ );
1078
+ header = Object.keys(this.fieldColumns).map(
1079
+ (key: string) => this.fieldColumns[key].model.caption!,
1080
+ );
1081
+ }
988
1082
  // 二维数组
989
1083
  const data = formatArrayData(filterVal, await getExportData());
990
1084
  await exportData(header, data, this.model.logicName!);
@@ -15,6 +15,7 @@ import {
15
15
  IPanelItemProvider,
16
16
  IControlProvider,
17
17
  IPanelItemContainerController,
18
+ IController,
18
19
  } from '../../../../interface';
19
20
  import { getAllPanelField } from '../../../../model';
20
21
  import { getPanelItemProvider } from '../../../../register';
@@ -22,6 +23,7 @@ import { PanelData } from '../../../../service/vo';
22
23
  import { ControlController } from '../../../common';
23
24
  import { PanelNotifyState } from '../../../constant';
24
25
  import { ControllerEvent } from '../../../utils';
26
+ import { CTX } from '../../../ctx';
25
27
 
26
28
  /**
27
29
  * 面板部件控制器
@@ -72,6 +74,8 @@ export class PanelController<
72
74
  */
73
75
  inputData: IData | undefined;
74
76
 
77
+ container?: IController;
78
+
75
79
  /**
76
80
  * 面板数据
77
81
  *
@@ -84,6 +88,17 @@ export class PanelController<
84
88
  return this.state.data;
85
89
  }
86
90
 
91
+ constructor(
92
+ model: T,
93
+ context: IContext,
94
+ params: IParams,
95
+ ctx: CTX,
96
+ container?: IController,
97
+ ) {
98
+ super(model, context, params, ctx);
99
+ this.container = container;
100
+ }
101
+
87
102
  protected initState(): void {
88
103
  super.initState();
89
104
  this.state.data = {};
@@ -3,7 +3,7 @@ import {
3
3
  IPortalMessage,
4
4
  RuntimeError,
5
5
  } from '@ibiz-template/core';
6
- import { IAppDataEntity } from '@ibiz/model-core';
6
+ import { IAppDEDataImport, IAppDataEntity } from '@ibiz/model-core';
7
7
 
8
8
  // 异步导入URL
9
9
  const asyncImportUrl = 'asyncimportdata2';
@@ -65,10 +65,14 @@ function listenAsyncAction(id: string): Promise<void> {
65
65
  export async function asyncImportData(
66
66
  file: File,
67
67
  appDataEntity: IAppDataEntity,
68
+ dataImport?: IAppDEDataImport,
68
69
  ): Promise<void> {
69
70
  const data = new FormData();
70
71
  data.append('file', file);
71
- const url = `${appDataEntity.codeName2!.toLowerCase()}/${asyncImportUrl}`;
72
+ let url = `${appDataEntity.codeName2!.toLowerCase()}/${asyncImportUrl}`;
73
+ if (dataImport?.codeName) {
74
+ url += `?srfimporttag=${dataImport.codeName}`;
75
+ }
72
76
  const res = await ibiz.net.request(url, {
73
77
  method: 'post',
74
78
  data,
@@ -95,10 +99,14 @@ export async function asyncImportData(
95
99
  export async function importData(
96
100
  file: File,
97
101
  appDataEntity: IAppDataEntity,
102
+ dataImport?: IAppDEDataImport,
98
103
  ): Promise<ImportDataResult> {
99
104
  const data = new FormData();
100
105
  data.append('file', file);
101
- const url = `${appDataEntity.codeName2!.toLowerCase()}/${importUrl}`;
106
+ let url = `${appDataEntity.codeName2!.toLowerCase()}/${importUrl}`;
107
+ if (dataImport?.codeName) {
108
+ url += `?srfimporttag=${dataImport.codeName}`;
109
+ }
102
110
  const res = await ibiz.net.request(url, {
103
111
  method: 'post',
104
112
  data,