@ibiz-template/runtime 0.4.1-dev.0 → 0.4.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 +34 -8
- package/dist/index.system.min.js +2 -2
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.d.ts +8 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.js +16 -1
- package/out/controller/utils/data-file-util/data-file-util.js +3 -3
- package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/front-ui-action-provider.js +25 -7
- package/package.json +3 -3
- package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts +17 -1
- package/src/ui-action/provider/front-ui-action-provider.ts +26 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IControlProvider, IMDControlController } from '../../../../../interface';
|
|
2
2
|
import { FormMDCtrlController } from './form-mdctrl.controller';
|
|
3
|
+
import { FormNotifyState } from '../../../../constant';
|
|
3
4
|
/**
|
|
4
5
|
* 表单多数据部件(引用实体多数据部件模型)控制器
|
|
5
6
|
* 类型是列表,卡片,表格时
|
|
@@ -47,6 +48,13 @@ export declare class FormMDCtrlMDController extends FormMDCtrlController {
|
|
|
47
48
|
*/
|
|
48
49
|
create(): void;
|
|
49
50
|
refresh(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 表单状态变更通知
|
|
53
|
+
*
|
|
54
|
+
* @author lxm
|
|
55
|
+
* @date 2022-09-20 18:09:07
|
|
56
|
+
*/
|
|
57
|
+
formStateNotify(state: FormNotifyState): Promise<void>;
|
|
50
58
|
dataChangeNotify(names: string[]): Promise<void>;
|
|
51
59
|
}
|
|
52
60
|
//# sourceMappingURL=form-mdctrl-md.controller.d.ts.map
|
package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-mdctrl-md.controller.d.ts","sourceRoot":"","sources":["../../../../../../src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"form-mdctrl-md.controller.d.ts","sourceRoot":"","sources":["../../../../../../src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,oBAAoB;IAC9D;;;;;;OAMG;IACH,UAAU,EAAG,gBAAgB,CAAC;IAE9B;;;;;OAKG;IACH,YAAY,EAAG,oBAAoB,CAAC;cAEpB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBvC;;;;;OAKG;IACH,YAAY,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAYpD;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAId;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAWd,OAAO,IAAI,IAAI;IAQf;;;;;OAKG;IACG,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtD,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQvD"}
|
|
@@ -68,7 +68,22 @@ export class FormMDCtrlMDController extends FormMDCtrlController {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
refresh() {
|
|
71
|
-
this.mdController
|
|
71
|
+
if (this.mdController) {
|
|
72
|
+
this.mdController.refresh();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
ibiz.log.debug('mdController不存在');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 表单状态变更通知
|
|
80
|
+
*
|
|
81
|
+
* @author lxm
|
|
82
|
+
* @date 2022-09-20 18:09:07
|
|
83
|
+
*/
|
|
84
|
+
async formStateNotify(state) {
|
|
85
|
+
await super.formStateNotify(state);
|
|
86
|
+
this.refresh();
|
|
72
87
|
}
|
|
73
88
|
async dataChangeNotify(names) {
|
|
74
89
|
await super.dataChangeNotify(names);
|
|
@@ -101,9 +101,9 @@ export async function exportData(header, data, fileName) {
|
|
|
101
101
|
}
|
|
102
102
|
try {
|
|
103
103
|
exportExcel.exportJsonToExcel({
|
|
104
|
-
header,
|
|
105
|
-
data,
|
|
106
|
-
filename: fileName,
|
|
104
|
+
header, // 表头内容 数组格式
|
|
105
|
+
data, // 具体数据 这是个二维数组
|
|
106
|
+
filename: fileName, // 文件名称
|
|
107
107
|
autoWidth: true, // 单元格是否自适应
|
|
108
108
|
});
|
|
109
109
|
return { ok: true };
|
|
@@ -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":"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;IA+D3B;;;;;;;;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;
|
|
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;IA+D3B;;;;;;;;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;IAgEhB;;;;;;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,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC;CAoDjB"}
|
|
@@ -85,19 +85,19 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
85
85
|
* @return {*}
|
|
86
86
|
*/
|
|
87
87
|
async executePrint(action, args) {
|
|
88
|
-
var _a, _b;
|
|
88
|
+
var _a, _b, _c;
|
|
89
89
|
// 处理参数
|
|
90
|
-
const { resultParams } = await this.handleParams(action, args.context, args.data, args.params);
|
|
90
|
+
const { resultContext, resultParams } = await this.handleParams(action, args.context, args.data, args.params);
|
|
91
91
|
const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
|
|
92
92
|
const appDEPrint = (_a = appDataEntity.appDEPrints) === null || _a === void 0 ? void 0 : _a.find(print => {
|
|
93
93
|
return print.id === action.appDEPrintId;
|
|
94
94
|
});
|
|
95
95
|
if (appDEPrint) {
|
|
96
96
|
let requestUrl = '';
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (resultContext &&
|
|
98
|
+
resultContext[appDataEntity.codeName.toLowerCase()]) {
|
|
99
99
|
// TODO 临时写死printdata, 非标准,后续优化
|
|
100
|
-
requestUrl += `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/printdata/${
|
|
100
|
+
requestUrl += `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/printdata/${resultContext[appDataEntity.codeName.toLowerCase()]}`;
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
103
|
throw new RuntimeError('没有找到数据主键');
|
|
@@ -108,8 +108,26 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
108
108
|
params: Object.assign({ srfprinttag: appDEPrint.codeName }, resultParams),
|
|
109
109
|
});
|
|
110
110
|
if (res.ok) {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
// 存在srfcontenttype参数需响应文件
|
|
112
|
+
if (resultParams && resultParams.srfcontenttype) {
|
|
113
|
+
// 获取文件
|
|
114
|
+
const disposition = res.headers['content-disposition'];
|
|
115
|
+
const filename = (_c = disposition
|
|
116
|
+
.split(';')
|
|
117
|
+
.find((str) => str.indexOf('filename=') !== -1)) === null || _c === void 0 ? void 0 : _c.slice(9);
|
|
118
|
+
const href = URL.createObjectURL(res.data);
|
|
119
|
+
const a = document.createElement('a');
|
|
120
|
+
a.href = href;
|
|
121
|
+
a.download = filename;
|
|
122
|
+
document.body.appendChild(a);
|
|
123
|
+
a.click();
|
|
124
|
+
document.body.removeChild(a);
|
|
125
|
+
URL.revokeObjectURL(href);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const link = window.URL.createObjectURL(res.data);
|
|
129
|
+
window.open(link, '_blank');
|
|
130
|
+
}
|
|
113
131
|
}
|
|
114
132
|
else {
|
|
115
133
|
throw new RuntimeError('打印失败');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.4.1
|
|
3
|
+
"version": "0.4.1",
|
|
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.
|
|
49
|
+
"@ibiz-template/core": "^0.4.0",
|
|
50
50
|
"@ibiz/model-core": "^0.0.21",
|
|
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": "
|
|
62
|
+
"gitHead": "49c2ab8952e9fdaf586a4819a8fa69c817bc8841"
|
|
63
63
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../../../../interface';
|
|
11
11
|
import { getControlProvider } from '../../../../../register';
|
|
12
12
|
import { FormMDCtrlController } from './form-mdctrl.controller';
|
|
13
|
+
import { FormNotifyState } from '../../../../constant';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* 表单多数据部件(引用实体多数据部件模型)控制器
|
|
@@ -104,7 +105,22 @@ export class FormMDCtrlMDController extends FormMDCtrlController {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
refresh(): void {
|
|
107
|
-
this.mdController
|
|
108
|
+
if (this.mdController) {
|
|
109
|
+
this.mdController.refresh();
|
|
110
|
+
} else {
|
|
111
|
+
ibiz.log.debug('mdController不存在');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 表单状态变更通知
|
|
117
|
+
*
|
|
118
|
+
* @author lxm
|
|
119
|
+
* @date 2022-09-20 18:09:07
|
|
120
|
+
*/
|
|
121
|
+
async formStateNotify(state: FormNotifyState): Promise<void> {
|
|
122
|
+
await super.formStateNotify(state);
|
|
123
|
+
this.refresh();
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
async dataChangeNotify(names: string[]): Promise<void> {
|
|
@@ -124,7 +124,7 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
124
124
|
args: IUILogicParams,
|
|
125
125
|
): Promise<void> {
|
|
126
126
|
// 处理参数
|
|
127
|
-
const { resultParams } = await this.handleParams(
|
|
127
|
+
const { resultContext, resultParams } = await this.handleParams(
|
|
128
128
|
action,
|
|
129
129
|
args.context,
|
|
130
130
|
args.data,
|
|
@@ -138,11 +138,13 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
138
138
|
});
|
|
139
139
|
if (appDEPrint) {
|
|
140
140
|
let requestUrl: string = '';
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (
|
|
142
|
+
resultContext &&
|
|
143
|
+
resultContext[appDataEntity.codeName!.toLowerCase()]
|
|
144
|
+
) {
|
|
143
145
|
// TODO 临时写死printdata, 非标准,后续优化
|
|
144
146
|
requestUrl += `/${appDataEntity.codeName2?.toLowerCase()}/printdata/${
|
|
145
|
-
|
|
147
|
+
resultContext[appDataEntity.codeName!.toLowerCase()]
|
|
146
148
|
}`;
|
|
147
149
|
} else {
|
|
148
150
|
throw new RuntimeError('没有找到数据主键');
|
|
@@ -156,8 +158,26 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
156
158
|
},
|
|
157
159
|
});
|
|
158
160
|
if (res.ok) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
// 存在srfcontenttype参数需响应文件
|
|
162
|
+
if (resultParams && resultParams.srfcontenttype) {
|
|
163
|
+
// 获取文件
|
|
164
|
+
const disposition = res.headers['content-disposition'];
|
|
165
|
+
const filename = disposition
|
|
166
|
+
.split(';')
|
|
167
|
+
.find((str: string) => str.indexOf('filename=') !== -1)
|
|
168
|
+
?.slice(9);
|
|
169
|
+
const href = URL.createObjectURL(res.data as Blob);
|
|
170
|
+
const a = document.createElement('a');
|
|
171
|
+
a.href = href;
|
|
172
|
+
a.download = filename;
|
|
173
|
+
document.body.appendChild(a);
|
|
174
|
+
a.click();
|
|
175
|
+
document.body.removeChild(a);
|
|
176
|
+
URL.revokeObjectURL(href);
|
|
177
|
+
} else {
|
|
178
|
+
const link = window.URL.createObjectURL(res.data as Blob);
|
|
179
|
+
window.open(link, '_blank');
|
|
180
|
+
}
|
|
161
181
|
} else {
|
|
162
182
|
throw new RuntimeError('打印失败');
|
|
163
183
|
}
|