super-page-runtime 2.0.76 → 2.0.81
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/es/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/es/components/runtime/utils/api/api-util.d.ts +2 -2
- package/dist/es/components/runtime/utils/api/api-util.js +23 -14
- package/dist/es/components/runtime/utils/api/page-expose-util.js +136 -66
- package/dist/es/components/runtime/utils/common-util.d.ts +8 -0
- package/dist/es/components/runtime/utils/common-util.js +20 -0
- package/dist/es/components/runtime/utils/events/event-util.js +43 -2
- package/dist/es/components/runtime/utils/events/standard-event.js +84 -41
- package/dist/es/components/runtime/utils/events/validator-util.d.ts +1 -0
- package/dist/es/components/runtime/utils/events/validator-util.js +42 -55
- package/dist/es/components/runtime/utils/global-refs.d.ts +6 -0
- package/dist/es/components/runtime/utils/global-refs.js +11 -0
- package/dist/es/components/runtime/utils/interfaces/page-design-types.d.ts +1 -0
- package/dist/es/components/runtime/utils/page-helper-util.js +4 -6
- package/dist/es/components/runtime/utils/page-init-util.d.ts +3 -1
- package/dist/es/components/runtime/utils/page-init-util.js +71 -16
- package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +9 -2
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +2 -1
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +4 -2
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +5 -17
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +4 -1
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +3 -2
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +35 -15
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page.vue.js +10 -7
- package/dist/es/style.css +3 -0
- package/package.json +2 -2
|
@@ -10,9 +10,9 @@ export declare function setCustomRules(pageContext: PageContext, customRules: an
|
|
|
10
10
|
* 刷新页面
|
|
11
11
|
* @param pageContext
|
|
12
12
|
*/
|
|
13
|
-
export declare function refreshPage(pageContext: PageContext): void;
|
|
13
|
+
export declare function refreshPage(pageContext: PageContext, id?: any): void;
|
|
14
14
|
/**
|
|
15
15
|
* 获得表单数据
|
|
16
16
|
* @param pageContext
|
|
17
17
|
*/
|
|
18
|
-
export declare function getFormData(pageContext: PageContext): Promise<unknown>;
|
|
18
|
+
export declare function getFormData(pageContext: PageContext, id?: any): Promise<unknown>;
|
|
@@ -5,20 +5,21 @@ import { getAdditionalParamMap, dealCompleteTaskParam } from "../events/standard
|
|
|
5
5
|
import { packageCustomRules, getWorkflowRules } from "../events/validator-util.js";
|
|
6
6
|
import { handleEvent } from "../events/event-util.js";
|
|
7
7
|
import { functions } from "./page-expose-util.js";
|
|
8
|
-
function refreshPage(pageContext) {
|
|
9
|
-
getFormData(pageContext).then((commonEntity) => {
|
|
8
|
+
function refreshPage(pageContext, id) {
|
|
9
|
+
getFormData(pageContext, id).then((commonEntity) => {
|
|
10
10
|
pageContext.isRefresh = true;
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function getFormData(pageContext) {
|
|
13
|
+
function getFormData(pageContext, id) {
|
|
14
14
|
const pageType = pageContext.pageType;
|
|
15
15
|
if (pageType && pageType === "form") {
|
|
16
16
|
console.log("获取表单数据getData--pageContext=", pageContext);
|
|
17
|
+
pageContext.canClick = false;
|
|
17
18
|
const isWorkflow = pageContext.workflowCode ? true : false;
|
|
18
19
|
if (isWorkflow) {
|
|
19
|
-
return getWorkflowFormData(pageContext);
|
|
20
|
+
return getWorkflowFormData(pageContext, id);
|
|
20
21
|
} else {
|
|
21
|
-
return getCommonFormData(pageContext);
|
|
22
|
+
return getCommonFormData(pageContext, id);
|
|
22
23
|
}
|
|
23
24
|
} else {
|
|
24
25
|
return new Promise((resolve, reject) => {
|
|
@@ -26,14 +27,14 @@ function getFormData(pageContext) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
function getCommonFormData(pageContext) {
|
|
30
|
+
function getCommonFormData(pageContext, id) {
|
|
30
31
|
return new Promise((resolve, reject) => {
|
|
31
32
|
const systemCode = pageContext.systemCode;
|
|
32
33
|
const pageCode = pageContext.code;
|
|
33
34
|
const pageVersion = pageContext.version;
|
|
34
35
|
const additionalParamMap = getAdditionalParamMap(pageContext);
|
|
35
|
-
const dataId = additionalParamMap && additionalParamMap.id ? additionalParamMap.id : null;
|
|
36
|
-
const ids = additionalParamMap ? additionalParamMap.ids : null;
|
|
36
|
+
const dataId = id ? id : additionalParamMap && additionalParamMap.id ? additionalParamMap.id : null;
|
|
37
|
+
const ids = id ? [id] : additionalParamMap ? additionalParamMap.ids : null;
|
|
37
38
|
const taskId = additionalParamMap ? additionalParamMap.taskId : null;
|
|
38
39
|
const permissionPrefix = pageCode;
|
|
39
40
|
console.log("getCommonFormData-----pageContext=", pageContext);
|
|
@@ -74,6 +75,9 @@ function getCommonFormData(pageContext) {
|
|
|
74
75
|
});
|
|
75
76
|
param["listCodes"] = listCodes;
|
|
76
77
|
}
|
|
78
|
+
if (pageContext.refercePropMap) {
|
|
79
|
+
param["refercePropMap"] = pageContext.refercePropMap;
|
|
80
|
+
}
|
|
77
81
|
const urlForView = backendUrl + "/dsc/commons/gets";
|
|
78
82
|
http.post(urlForView, param).then((commonEntity) => {
|
|
79
83
|
if (commonEntity) {
|
|
@@ -97,20 +101,22 @@ function getCommonFormData(pageContext) {
|
|
|
97
101
|
label: ""
|
|
98
102
|
};
|
|
99
103
|
handleEvent(null, pageContext, pageDesign, "load");
|
|
104
|
+
pageContext.canClick = true;
|
|
100
105
|
resolve(commonEntity);
|
|
101
106
|
}).catch((error) => {
|
|
107
|
+
pageContext.canClick = true;
|
|
102
108
|
reject(error);
|
|
103
109
|
});
|
|
104
110
|
});
|
|
105
111
|
}
|
|
106
|
-
function getWorkflowFormData(pageContext) {
|
|
112
|
+
function getWorkflowFormData(pageContext, id) {
|
|
107
113
|
return new Promise((resolve, reject) => {
|
|
108
114
|
const systemCode = pageContext.systemCode;
|
|
109
115
|
const pageCode = pageContext.code;
|
|
110
116
|
const pageVersion = pageContext.version;
|
|
111
117
|
const additionalParamMap = getAdditionalParamMap(pageContext);
|
|
112
|
-
const dataId = additionalParamMap && additionalParamMap.id ? additionalParamMap.id : null;
|
|
113
|
-
const ids = additionalParamMap ? additionalParamMap.ids : null;
|
|
118
|
+
const dataId = id ? id : additionalParamMap && additionalParamMap.id ? additionalParamMap.id : null;
|
|
119
|
+
const ids = id ? [id] : additionalParamMap ? additionalParamMap.ids : null;
|
|
114
120
|
const taskId = additionalParamMap ? additionalParamMap.taskId : null;
|
|
115
121
|
const permissionPrefix = pageCode;
|
|
116
122
|
const param = {
|
|
@@ -152,6 +158,9 @@ function getWorkflowFormData(pageContext) {
|
|
|
152
158
|
if (pageContext.beanName) {
|
|
153
159
|
param["beanName"] = pageContext.beanName;
|
|
154
160
|
}
|
|
161
|
+
if (pageContext.refercePropMap) {
|
|
162
|
+
param["refercePropMap"] = pageContext.refercePropMap;
|
|
163
|
+
}
|
|
155
164
|
const baseUrl = getBaseUrl(pageContext.backendUrl, pageContext.isTest);
|
|
156
165
|
const urlForView = baseUrl + "/dsc/workflow-commons/gets";
|
|
157
166
|
http.post(urlForView, param).then((commonEntity) => {
|
|
@@ -176,8 +185,10 @@ function getWorkflowFormData(pageContext) {
|
|
|
176
185
|
};
|
|
177
186
|
handleEvent(null, pageContext, pageDesign, "load");
|
|
178
187
|
}
|
|
188
|
+
pageContext.canClick = true;
|
|
179
189
|
resolve(commonEntity);
|
|
180
190
|
}).catch((error) => {
|
|
191
|
+
pageContext.canClick = true;
|
|
181
192
|
reject(error);
|
|
182
193
|
});
|
|
183
194
|
});
|
|
@@ -285,9 +296,7 @@ function formatAdditionalParamMapIds(ids) {
|
|
|
285
296
|
ids = ids.split(",");
|
|
286
297
|
} else if (typeof ids === "number") {
|
|
287
298
|
ids = [ids];
|
|
288
|
-
} else
|
|
289
|
-
console.error("ids参数类型错误");
|
|
290
|
-
}
|
|
299
|
+
} else ;
|
|
291
300
|
}
|
|
292
301
|
return ids;
|
|
293
302
|
}
|
|
@@ -1,74 +1,91 @@
|
|
|
1
1
|
import { setValueForVariableName } from "../page-helper-util.js";
|
|
2
|
-
import { getComponentRefByCode } from "../global-refs.js";
|
|
2
|
+
import { getComponentRefByCode, getAllComponentRefs } from "../global-refs.js";
|
|
3
3
|
import eventBus from "../eventBus.js";
|
|
4
4
|
import http from "agilebuilder-ui/src/utils/request";
|
|
5
5
|
import { getAdditionalParamMap } from "../events/standard-event.js";
|
|
6
|
+
import { i18nValidatePropRulesMessage } from "../events/validator-util.js";
|
|
6
7
|
const functions = {
|
|
7
8
|
/**
|
|
8
9
|
* 展示页面中的某个组件元素
|
|
9
10
|
* @param pageDesign 页面设计对象
|
|
10
11
|
* @param codes 展示组件所绑定的变量或者是绑定的code值, 绑定变量时传递变量名, 如果绑定的变量为${data.xxx}则传递xxx
|
|
11
12
|
*/
|
|
12
|
-
showElement: function(pageContext, codes) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
showElement: function(pageContext, codes, isInit) {
|
|
14
|
+
if (isInit) {
|
|
15
|
+
packageInitInfo(pageContext, "showElement", codes);
|
|
16
|
+
} else {
|
|
17
|
+
codes.forEach((code) => {
|
|
18
|
+
const ref = getComponentRefByCode(pageContext, code);
|
|
19
|
+
if (ref) {
|
|
20
|
+
ref.show();
|
|
21
|
+
} else {
|
|
22
|
+
console.error(`未找到code为${code}的组件`);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
27
|
/**
|
|
23
28
|
* 隐藏页面中的某个组件元素
|
|
24
29
|
* @param pageDesign 页面设计对象
|
|
25
30
|
* @param codes 展示组件所绑定的变量或者是绑定的code值, 绑定变量时传递变量名, 如果绑定的变量为${data.xxx}则传递xxx
|
|
26
31
|
*/
|
|
27
|
-
hideElement: function(pageContext, codes) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
hideElement: function(pageContext, codes, isInit) {
|
|
33
|
+
if (isInit) {
|
|
34
|
+
packageInitInfo(pageContext, "hideElement", codes);
|
|
35
|
+
} else {
|
|
36
|
+
codes.forEach((code) => {
|
|
37
|
+
const ref = getComponentRefByCode(pageContext, code);
|
|
38
|
+
if (ref) {
|
|
39
|
+
ref.hide();
|
|
40
|
+
} else {
|
|
41
|
+
console.error(`未找到code为${code}的组件`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
36
45
|
},
|
|
37
46
|
/**
|
|
38
47
|
* 设置组件元素可用状态
|
|
39
48
|
* @param pageContext
|
|
40
49
|
* @param codes ['name', 'age']
|
|
41
50
|
*/
|
|
42
|
-
enableElement: function(pageContext, codes) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
enableElement: function(pageContext, codes, isInit) {
|
|
52
|
+
if (isInit) {
|
|
53
|
+
packageInitInfo(pageContext, "enableElement", codes);
|
|
54
|
+
} else {
|
|
55
|
+
codes.forEach((code) => {
|
|
56
|
+
const ref = getComponentRefByCode(pageContext, code);
|
|
57
|
+
if (ref) {
|
|
58
|
+
const configure = ref.getConfigure();
|
|
59
|
+
if (configure && configure.runtime.props) {
|
|
60
|
+
configure.runtime.props.state = "enabled";
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
console.error(`未找到code为${code}的组件`);
|
|
49
64
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
54
67
|
},
|
|
55
68
|
/**
|
|
56
69
|
* 禁用页面中的某个组件元素
|
|
57
70
|
* @param pageContext
|
|
58
71
|
* @param codes ['name', 'age']
|
|
59
72
|
*/
|
|
60
|
-
disableElement: function(pageContext, codes) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
disableElement: function(pageContext, codes, isInit) {
|
|
74
|
+
if (isInit) {
|
|
75
|
+
packageInitInfo(pageContext, "disableElement", codes);
|
|
76
|
+
} else {
|
|
77
|
+
codes.forEach((code) => {
|
|
78
|
+
const ref = getComponentRefByCode(pageContext, code);
|
|
79
|
+
if (ref) {
|
|
80
|
+
const configure = ref.getConfigure();
|
|
81
|
+
if (configure && configure.runtime.props) {
|
|
82
|
+
configure.runtime.props.state = "disabled";
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
console.error(`未找到code为${code}的组件`);
|
|
67
86
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
72
89
|
},
|
|
73
90
|
/**
|
|
74
91
|
* 设置值
|
|
@@ -108,14 +125,32 @@ const functions = {
|
|
|
108
125
|
});
|
|
109
126
|
},
|
|
110
127
|
/**
|
|
111
|
-
*
|
|
128
|
+
* 表单编辑权限动态控制
|
|
112
129
|
* @param pageContext
|
|
113
130
|
* @param keyValue [
|
|
131
|
+
{
|
|
132
|
+
name: '_all_fields', // _all_fields 表示所有字段
|
|
133
|
+
show: true,
|
|
134
|
+
readonly: true,
|
|
135
|
+
disabled: true,
|
|
136
|
+
required: true,
|
|
137
|
+
rules: [
|
|
138
|
+
{
|
|
139
|
+
required: true,
|
|
140
|
+
trigger: 'blur'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'email',
|
|
144
|
+
trigger: ['blur', 'change']
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
114
148
|
{
|
|
115
149
|
name: 'xxxx',
|
|
116
150
|
show: true,
|
|
117
151
|
readonly: true,
|
|
118
152
|
disabled: true,
|
|
153
|
+
required: true,
|
|
119
154
|
rules: [
|
|
120
155
|
{
|
|
121
156
|
required: true,
|
|
@@ -131,34 +166,28 @@ const functions = {
|
|
|
131
166
|
}
|
|
132
167
|
]
|
|
133
168
|
*/
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
pageContext
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (item.rules) {
|
|
143
|
-
pageContext.customRules[item.name] = item.rules;
|
|
169
|
+
dynamicControlFormEdit: function(pageContext, settings, isInit) {
|
|
170
|
+
if (isInit) {
|
|
171
|
+
packageInitInfo(pageContext, "dynamicControlFormEdit", settings);
|
|
172
|
+
} else {
|
|
173
|
+
if (!pageContext.customRules) {
|
|
174
|
+
pageContext.customRules = {};
|
|
144
175
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (item.
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
const configure = ref.getConfigure();
|
|
151
|
-
if (item.required !== void 0) {
|
|
152
|
-
configure.runtime.props.required = item.required;
|
|
176
|
+
for (let i = 0; i < settings.length; i++) {
|
|
177
|
+
const item = settings[i];
|
|
178
|
+
if (!item.name) {
|
|
179
|
+
continue;
|
|
153
180
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
181
|
+
const allFields = "_all_fields";
|
|
182
|
+
if (item.name === allFields) {
|
|
183
|
+
packageAllFeildsRules(pageContext, item);
|
|
184
|
+
break;
|
|
185
|
+
} else {
|
|
186
|
+
const ref = getComponentRefByCode(pageContext, item.name);
|
|
187
|
+
packageOneFeildRules(pageContext, item, item.name, ref);
|
|
159
188
|
}
|
|
160
189
|
}
|
|
161
|
-
}
|
|
190
|
+
}
|
|
162
191
|
},
|
|
163
192
|
/**
|
|
164
193
|
* 调用服务流,
|
|
@@ -201,6 +230,47 @@ const functions = {
|
|
|
201
230
|
});
|
|
202
231
|
}
|
|
203
232
|
};
|
|
233
|
+
function packageAllFeildsRules(pageContext, item) {
|
|
234
|
+
const allComponetRefs = getAllComponentRefs(pageContext);
|
|
235
|
+
if (allComponetRefs) {
|
|
236
|
+
const props = Object.keys(allComponetRefs);
|
|
237
|
+
props.forEach((propName) => {
|
|
238
|
+
const componentRef = allComponetRefs[propName];
|
|
239
|
+
packageOneFeildRules(pageContext, item, propName, componentRef);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function packageOneFeildRules(pageContext, item, propName, ref) {
|
|
244
|
+
if (propName) {
|
|
245
|
+
if (item.rules) {
|
|
246
|
+
i18nValidatePropRulesMessage(item.rules, false);
|
|
247
|
+
pageContext.customRules[propName] = item.rules;
|
|
248
|
+
} else {
|
|
249
|
+
pageContext.customRules[propName] = [];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (ref) {
|
|
253
|
+
const configure = ref.getConfigure();
|
|
254
|
+
if (item.show !== void 0) {
|
|
255
|
+
item.show ? ref.show() : ref.hide();
|
|
256
|
+
}
|
|
257
|
+
if (item.required !== void 0) {
|
|
258
|
+
configure.runtime.props.required = item.required;
|
|
259
|
+
}
|
|
260
|
+
if (item.readonly !== void 0) {
|
|
261
|
+
item.readonly ? configure.runtime.props.state = "readonly" : configure.runtime.props.state = "enabled";
|
|
262
|
+
}
|
|
263
|
+
if (item.disabled !== void 0) {
|
|
264
|
+
item.disabled ? configure.runtime.props.state = "disabled" : configure.runtime.props.state = "enabled";
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function packageInitInfo(pageContext, type, settings) {
|
|
269
|
+
if (!pageContext.initInfo) {
|
|
270
|
+
pageContext.initInfo = {};
|
|
271
|
+
}
|
|
272
|
+
pageContext.initInfo[type] = settings;
|
|
273
|
+
}
|
|
204
274
|
export {
|
|
205
275
|
functions
|
|
206
276
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Component } from './interfaces/page-design-types';
|
|
2
|
+
|
|
1
3
|
export declare function isArrayFn(value: any): boolean;
|
|
2
4
|
export declare function getBaseUrl(backendUrl: any, isTest?: boolean): any;
|
|
3
5
|
export declare function getRealRestApiPath(orgRestApiPath: any, systemCode: any, backendUrl: any, isTest?: boolean): any;
|
|
@@ -15,3 +17,9 @@ export declare function getListCode(pageCode: any, pageVersion: any, tableUuid:
|
|
|
15
17
|
*/
|
|
16
18
|
export declare function deepCopy(srcObj: any): any;
|
|
17
19
|
export declare function getWorkflowId(pageContext: any): any;
|
|
20
|
+
/**
|
|
21
|
+
* 获得当前属性名,封装到class中,操作dom时可能会使用
|
|
22
|
+
* @param configure
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function getPropClassName(configure: Component): any;
|
|
@@ -96,10 +96,30 @@ function getWorkflowId(pageContext) {
|
|
|
96
96
|
}
|
|
97
97
|
return workflowId;
|
|
98
98
|
}
|
|
99
|
+
function getPropClassName(configure) {
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
let propClassName;
|
|
102
|
+
if (configure && ((_b = (_a = configure.props) == null ? void 0 : _a.base) == null ? void 0 : _b.prop)) {
|
|
103
|
+
let prop = (_d = (_c = configure.props) == null ? void 0 : _c.base) == null ? void 0 : _d.prop;
|
|
104
|
+
if (prop.indexOf("${") >= 0) {
|
|
105
|
+
prop = prop.substring(2, prop.lastIndexOf("}"));
|
|
106
|
+
}
|
|
107
|
+
const props = prop.split(".");
|
|
108
|
+
if (props.length === 2) {
|
|
109
|
+
propClassName = props[1];
|
|
110
|
+
} else if (props.length === 3) {
|
|
111
|
+
propClassName = props[1] + "__" + props[2];
|
|
112
|
+
}
|
|
113
|
+
} else if (configure.code) {
|
|
114
|
+
propClassName = configure.code;
|
|
115
|
+
}
|
|
116
|
+
return propClassName;
|
|
117
|
+
}
|
|
99
118
|
export {
|
|
100
119
|
deepCopy,
|
|
101
120
|
getBaseUrl,
|
|
102
121
|
getListCode,
|
|
122
|
+
getPropClassName,
|
|
103
123
|
getRealRestApiPath,
|
|
104
124
|
getWorkflowId,
|
|
105
125
|
isArrayFn,
|
|
@@ -102,7 +102,7 @@ function getHandleEvent($event, pageContext, configure, eventType, otherParams)
|
|
|
102
102
|
function handleEventUtil($event, pageContext, configure, eventType, isExecute, otherParams, skipValidate) {
|
|
103
103
|
const pageCode = pageContext.code;
|
|
104
104
|
const pageVersion = pageContext.version;
|
|
105
|
-
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
105
|
+
const events = configure && configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
106
106
|
let eventFun;
|
|
107
107
|
if (!skipValidate && eventType && eventType === "click") {
|
|
108
108
|
const tableUuid = getTableUuid(pageContext, configure);
|
|
@@ -162,8 +162,14 @@ function buttonClickEvent(pageContext, configure, eventParams) {
|
|
|
162
162
|
if (!judgeFlag) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
+
if (pageContext.canClick !== void 0 && pageContext.canClick === false) {
|
|
166
|
+
console.log("不能重复点击");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
165
169
|
canExecuteButton(eventParams).then((result) => {
|
|
166
170
|
if (result["canExecute"] === true) {
|
|
171
|
+
pageContext.clickUuid = configure.uuid;
|
|
172
|
+
pageContext.canClick = false;
|
|
167
173
|
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
168
174
|
const beforeValidateFormFunc = getEventFuncByType(pageContext, events, "beforeValidateForm");
|
|
169
175
|
let beforeValidateFormResult;
|
|
@@ -179,13 +185,19 @@ function buttonClickEvent(pageContext, configure, eventParams) {
|
|
|
179
185
|
beforeValidateFormResult = true;
|
|
180
186
|
}
|
|
181
187
|
if (!beforeValidateFormResult) {
|
|
188
|
+
pageContext.canClick = true;
|
|
182
189
|
return;
|
|
183
190
|
}
|
|
184
191
|
if (isPromise(beforeValidateFormResult)) {
|
|
185
192
|
beforeValidateFormResult.then((result2) => {
|
|
186
193
|
if (result2 && result2 === true) {
|
|
187
194
|
doValidateForm(pageContext, configure, eventParams);
|
|
195
|
+
} else {
|
|
196
|
+
pageContext.canClick = true;
|
|
188
197
|
}
|
|
198
|
+
}).catch((error) => {
|
|
199
|
+
console.log(error);
|
|
200
|
+
pageContext.canClick = true;
|
|
189
201
|
});
|
|
190
202
|
} else {
|
|
191
203
|
doValidateForm(pageContext, configure, eventParams);
|
|
@@ -207,21 +219,31 @@ function doValidateForm(pageContext, configure, eventParams) {
|
|
|
207
219
|
}
|
|
208
220
|
validateDataModelFunc(pageContext, configure, isEnableRequired).then((validateReslut) => {
|
|
209
221
|
if (!validateReslut) {
|
|
222
|
+
pageContext.canClick = true;
|
|
210
223
|
return;
|
|
211
224
|
}
|
|
212
225
|
const beforeClickResult = doBeforeClickEvent(pageContext, configure, eventParams);
|
|
213
226
|
if (!beforeClickResult) {
|
|
227
|
+
pageContext.canClick = true;
|
|
214
228
|
return;
|
|
215
229
|
}
|
|
216
230
|
if (isPromise(beforeClickResult)) {
|
|
217
231
|
beforeClickResult.then((result) => {
|
|
218
232
|
if (result) {
|
|
219
233
|
doClickEvent(pageContext, configure, clickEventFunObj, eventParams);
|
|
234
|
+
} else {
|
|
235
|
+
pageContext.canClick = true;
|
|
220
236
|
}
|
|
237
|
+
}).catch((error) => {
|
|
238
|
+
console.error(error);
|
|
239
|
+
pageContext.canClick = true;
|
|
221
240
|
});
|
|
222
241
|
} else {
|
|
223
242
|
doClickEvent(pageContext, configure, clickEventFunObj, eventParams);
|
|
224
243
|
}
|
|
244
|
+
}).catch((error) => {
|
|
245
|
+
console.error(error);
|
|
246
|
+
pageContext.canClick = true;
|
|
225
247
|
});
|
|
226
248
|
}
|
|
227
249
|
function doBeforeClickEvent(pageContext, configure, otherParams) {
|
|
@@ -258,6 +280,7 @@ function doClickCustomEvent(pageContext, configure, clickEventFuncObj, eventPara
|
|
|
258
280
|
const clickResult = callItemEvent(pageContext, configure, eventFun, eventParams);
|
|
259
281
|
const isListButton = isListPage(pageContext);
|
|
260
282
|
if (isNotDoAfterClick(isStandardEvent, event)) {
|
|
283
|
+
pageContext.canClick = true;
|
|
261
284
|
return;
|
|
262
285
|
}
|
|
263
286
|
if (isPromise(clickResult)) {
|
|
@@ -271,7 +294,12 @@ function doClickCustomEvent(pageContext, configure, clickEventFuncObj, eventPara
|
|
|
271
294
|
result,
|
|
272
295
|
isListButton
|
|
273
296
|
);
|
|
297
|
+
} else {
|
|
298
|
+
pageContext.canClick = true;
|
|
274
299
|
}
|
|
300
|
+
}).catch((error) => {
|
|
301
|
+
console.error(error);
|
|
302
|
+
pageContext.canClick = true;
|
|
275
303
|
});
|
|
276
304
|
} else {
|
|
277
305
|
doAfterClickFunc(
|
|
@@ -283,6 +311,8 @@ function doClickCustomEvent(pageContext, configure, clickEventFuncObj, eventPara
|
|
|
283
311
|
isListButton
|
|
284
312
|
);
|
|
285
313
|
}
|
|
314
|
+
} else {
|
|
315
|
+
pageContext.canClick = true;
|
|
286
316
|
}
|
|
287
317
|
}
|
|
288
318
|
function isNotDoAfterClick(isStandardEvent, clickEvent) {
|
|
@@ -295,7 +325,16 @@ function doAfterClickEvent(pageContext, configure, otherParams) {
|
|
|
295
325
|
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
296
326
|
const afterClickFunc = getEventFuncByType(pageContext, events, "afterClick");
|
|
297
327
|
if (afterClickFunc) {
|
|
298
|
-
callItemEvent(pageContext, configure, afterClickFunc, null, otherParams);
|
|
328
|
+
const afterFunc = callItemEvent(pageContext, configure, afterClickFunc, null, otherParams);
|
|
329
|
+
if (isPromise(afterFunc)) {
|
|
330
|
+
afterFunc.finally(() => {
|
|
331
|
+
pageContext.canClick = true;
|
|
332
|
+
});
|
|
333
|
+
} else {
|
|
334
|
+
pageContext.canClick = true;
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
pageContext.canClick = true;
|
|
299
338
|
}
|
|
300
339
|
}
|
|
301
340
|
function doAfterClickFunc(pageContext, configure, eventParams, isStandardEvent, result, isListButton) {
|
|
@@ -310,6 +349,7 @@ function doAfterClickFunc(pageContext, configure, eventParams, isStandardEvent,
|
|
|
310
349
|
);
|
|
311
350
|
} else {
|
|
312
351
|
pageContext.result = result;
|
|
352
|
+
pageContext.canClick = true;
|
|
313
353
|
}
|
|
314
354
|
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
315
355
|
const afterClickFunc = getEventFuncByType(pageContext, events, "afterClick");
|
|
@@ -320,6 +360,7 @@ function doAfterClickFunc(pageContext, configure, eventParams, isStandardEvent,
|
|
|
320
360
|
function doClickEvent(pageContext, configure, clickEventFunObj, eventParams) {
|
|
321
361
|
const linkPage = configure.props.linkPage;
|
|
322
362
|
if (linkPage && linkPage.jumpPageUrl) {
|
|
363
|
+
pageContext.canClick = true;
|
|
323
364
|
doClickJumpPageEvent(pageContext, configure, eventParams);
|
|
324
365
|
} else {
|
|
325
366
|
doClickCustomEvent(pageContext, configure, clickEventFunObj, eventParams);
|