@ibiz-template/runtime 0.3.2 → 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.
- package/dist/index.esm.js +583 -273
- package/dist/index.system.min.js +2 -2
- package/dist/index.system.min.js.map +1 -1
- package/out/app-hub.d.ts +5 -5
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +2 -2
- package/out/constant/sys-uiaction-tag.d.ts +4 -0
- package/out/constant/sys-uiaction-tag.d.ts.map +1 -1
- package/out/constant/sys-uiaction-tag.js +4 -0
- package/out/controller/common/control/control.controller.js +2 -2
- package/out/controller/control/app-menu/app-menu.controller.d.ts +2 -3
- package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.controller.d.ts +9 -0
- package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.controller.js +59 -0
- package/out/controller/control/grid/grid/grid.controller.d.ts +23 -2
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +73 -21
- package/out/controller/control/panel/panel/panel.controller.d.ts +4 -1
- package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
- package/out/controller/control/panel/panel/panel.controller.js +17 -16
- package/out/controller/utils/data-file-util/data-file-util.d.ts +3 -3
- package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
- package/out/controller/utils/data-file-util/data-file-util.js +10 -4
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +8 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +5 -5
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/common/i-app-service/i-app-service.d.ts +53 -0
- package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts +27 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-panel.controller.d.ts +8 -0
- package/out/interface/controller/controller/control/i-panel.controller.d.ts.map +1 -1
- package/out/interface/service/service/i-app-de.service.d.ts +66 -0
- package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
- package/out/model/utils/util.d.ts +5 -5
- package/out/model/utils/util.d.ts.map +1 -1
- package/out/model/utils/util.js +14 -6
- package/out/service/dto/method.dto.d.ts +2 -2
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +3 -1
- package/out/service/service/config/config.service.d.ts.map +1 -1
- package/out/service/service/control/control.service.d.ts +2 -2
- package/out/service/service/control/control.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.d.ts +6 -0
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +18 -0
- package/out/service/service/entity/method/method.d.ts +2 -3
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/work-flow/work-flow.service.d.ts.map +1 -1
- package/out/ui-action/provider/front-ui-action-provider.d.ts +24 -0
- package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/front-ui-action-provider.js +128 -1
- package/out/ui-action/provider/sys-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/sys-ui-action-provider.js +2 -0
- package/package.json +2 -2
- package/src/app-hub.ts +5 -5
- package/src/constant/sys-uiaction-tag.ts +4 -0
- package/src/controller/common/control/control.controller.ts +2 -2
- package/src/controller/control/app-menu/app-menu.controller.ts +2 -2
- package/src/controller/control/form/search-form/search-form.controller.ts +64 -0
- package/src/controller/control/grid/grid/grid.controller.ts +110 -27
- package/src/controller/control/panel/panel/panel.controller.ts +15 -0
- package/src/controller/utils/data-file-util/data-file-util.ts +11 -3
- package/src/engine/md-view.engine.ts +8 -0
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +5 -5
- package/src/interface/common/i-app-service/i-app-service.ts +71 -0
- package/src/interface/controller/controller/control/i-grid.controller.ts +30 -1
- package/src/interface/controller/controller/control/i-panel.controller.ts +9 -0
- package/src/interface/service/service/i-app-de.service.ts +96 -0
- package/src/model/utils/util.ts +16 -6
- package/src/service/dto/method.dto.ts +5 -3
- package/src/service/service/config/config.service.ts +2 -3
- package/src/service/service/control/control.service.ts +2 -2
- package/src/service/service/entity/de.service.ts +48 -0
- package/src/service/service/entity/method/method.ts +2 -3
- package/src/service/service/work-flow/work-flow.service.ts +2 -3
- package/src/ui-action/provider/front-ui-action-provider.ts +153 -1
- package/src/ui-action/provider/sys-ui-action-provider.ts +2 -0
|
@@ -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,
|
|
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.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"qx-util": "^0.4.8",
|
|
60
60
|
"ramda": "^0.29.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
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<
|
|
332
|
+
* @return {*} {Promise<IAppService>}
|
|
333
333
|
*/
|
|
334
|
-
async getAppAsync(key: string = ibiz.env.appId): Promise<
|
|
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 {*} {
|
|
344
|
+
* @return {*} {IAppService}
|
|
345
345
|
*/
|
|
346
|
-
getApp(app?: string | IApplication):
|
|
346
|
+
getApp(app?: string | IApplication): IAppService {
|
|
347
347
|
let key: string | null = null;
|
|
348
348
|
if (app) {
|
|
349
349
|
if (app instanceof Object) {
|
|
@@ -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!:
|
|
30
|
+
app!: IAppService;
|
|
31
31
|
|
|
32
32
|
protected initState(): void {
|
|
33
33
|
super.initState();
|
|
@@ -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 {
|
|
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
|
|
@@ -913,6 +935,35 @@ export class GridController
|
|
|
913
935
|
return res.data;
|
|
914
936
|
}
|
|
915
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
|
+
|
|
916
967
|
/**
|
|
917
968
|
* 数据导出
|
|
918
969
|
*
|
|
@@ -921,35 +972,55 @@ export class GridController
|
|
|
921
972
|
* @memberof MDControlController
|
|
922
973
|
*/
|
|
923
974
|
async exportData(_args: { event: MouseEvent; params: IData }): Promise<void> {
|
|
924
|
-
//
|
|
925
|
-
|
|
926
|
-
this.
|
|
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
|
+
}
|
|
927
986
|
// 数据格式化
|
|
928
987
|
const formatExcelData = (data: IData[]): IData[] => {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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
|
+
}
|
|
935
1005
|
const cloneData = clone(
|
|
936
1006
|
data.map(item => {
|
|
937
1007
|
return item.getOrigin();
|
|
938
1008
|
}),
|
|
939
1009
|
);
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
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
|
+
});
|
|
951
1021
|
return cloneData;
|
|
952
1022
|
};
|
|
1023
|
+
// 获取导出数据
|
|
953
1024
|
const getExportData = async (): Promise<IData[]> => {
|
|
954
1025
|
const type = _args.params?.type;
|
|
955
1026
|
let data: IData[] = [];
|
|
@@ -988,14 +1059,26 @@ export class GridController
|
|
|
988
1059
|
});
|
|
989
1060
|
});
|
|
990
1061
|
};
|
|
1062
|
+
|
|
991
1063
|
// 头部id数组
|
|
992
|
-
|
|
993
|
-
(key: string) => items[key].model.id!,
|
|
994
|
-
);
|
|
1064
|
+
let filterVal: string[] = [];
|
|
995
1065
|
// 表头数组
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
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
|
+
}
|
|
999
1082
|
// 二维数组
|
|
1000
1083
|
const data = formatArrayData(filterVal, await getExportData());
|
|
1001
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
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -187,6 +187,14 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
187
187
|
await this.exportData(args);
|
|
188
188
|
return null;
|
|
189
189
|
}
|
|
190
|
+
if (key === SysUIActionTag.SEARCH) {
|
|
191
|
+
await this.searchForm.search();
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
if (key === SysUIActionTag.RESET) {
|
|
195
|
+
await this.searchForm.reset();
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
190
198
|
if (key === SysUIActionTag.COPY) {
|
|
191
199
|
this.copy(args);
|
|
192
200
|
return null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IAppDataEntity, IAppView, IApplication } from '@ibiz/model-core';
|
|
2
|
-
import { Application } from '../../../application';
|
|
3
2
|
import { Convert } from '../../../hub';
|
|
4
3
|
import { ModelLoaderProvider } from '../../provider';
|
|
5
4
|
import { IAppConfigService } from '../i-app-config-service/i-app-config-service';
|
|
6
5
|
import { IHubController } from '../../controller';
|
|
7
6
|
import { IConfigService } from '../../service';
|
|
7
|
+
import { IAppService } from '../i-app-service/i-app-service';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* 应用 hub 服务
|
|
@@ -152,9 +152,9 @@ export interface IAppHubService {
|
|
|
152
152
|
* @author chitanda
|
|
153
153
|
* @date 2023-04-23 15:04:46
|
|
154
154
|
* @param {string} [appId=ibiz.env.appId]
|
|
155
|
-
* @return {*} {Promise<
|
|
155
|
+
* @return {*} {Promise<IAppService>}
|
|
156
156
|
*/
|
|
157
|
-
getAppAsync(appId?: string): Promise<
|
|
157
|
+
getAppAsync(appId?: string): Promise<IAppService>;
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* 获取应用实例
|
|
@@ -162,7 +162,7 @@ export interface IAppHubService {
|
|
|
162
162
|
* @author chitanda
|
|
163
163
|
* @date 2023-04-23 15:04:24
|
|
164
164
|
* @param {(string | IApplication)} [app]
|
|
165
|
-
* @return {*} {
|
|
165
|
+
* @return {*} {IAppService}
|
|
166
166
|
*/
|
|
167
|
-
getApp(app?: string | IApplication):
|
|
167
|
+
getApp(app?: string | IApplication): IAppService;
|
|
168
168
|
}
|