@gct-paas/render 0.1.4-dev.9 → 0.1.5-dev.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.min.css +2 -0
- package/dist/loader.esm.min.js +1 -0
- package/es/Event/Dependency/controller.d.ts +1 -1
- package/es/Event/Dependency/controller.mjs +81 -94
- package/es/Event/Dependency/displayRule.mjs +130 -68
- package/es/Event/Dependency/useDependency.mjs +117 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +1 -1
- package/es/Event/Dependency/useDependencyToShow.mjs +100 -96
- package/es/Event/baseEvent.d.ts +28 -32
- package/es/Event/baseEvent.mjs +383 -439
- package/es/Event/bizServiceRequest.d.ts +1 -1
- package/es/Event/bizServiceRequest.mjs +29 -41
- package/es/Event/eventType.d.ts +1 -1
- package/es/Event/eventType.mjs +1 -0
- package/es/Event/index.d.ts +6 -3
- package/es/Event/index.mjs +7 -0
- package/es/Event/utils/appRedis.mjs +39 -49
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +104 -0
- package/es/Event/utils/processRovedInfo.mjs +228 -294
- package/es/Event/utils/runGlobalByPage.d.ts +4 -1
- package/es/Event/utils/runGlobalByPage.mjs +297 -301
- package/es/Event/utils/verificationVar.mjs +32 -38
- package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
- package/es/_virtual/_rolldown/runtime.mjs +13 -0
- package/es/components/HandwritingPad.vue.d.ts +27 -0
- package/es/components/HandwritingPad.vue.mjs +7 -0
- package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
- package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.mjs +1 -0
- package/es/constant/data-format.d.ts +52 -0
- package/es/constant/data-format.mjs +66 -0
- package/es/constant/date-time.d.ts +99 -0
- package/es/constant/date-time.mjs +187 -0
- package/es/constant/index.d.ts +94 -0
- package/es/constant/index.mjs +100 -0
- package/es/controller/design-render/design-render.controller.d.ts +18 -0
- package/es/controller/design-render/design-render.controller.mjs +78 -0
- package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
- package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
- package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
- package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
- package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
- package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
- package/es/controller/index.d.ts +4 -0
- package/es/controller/index.mjs +4 -0
- package/es/enums/index.mjs +17 -5
- package/es/hooks/index.d.ts +3 -0
- package/es/hooks/index.mjs +3 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
- package/es/hooks/useStorageRef.mjs +35 -31
- package/es/hooks/widgets/useFileAttrsHooks.d.ts +28 -0
- package/es/hooks/widgets/useFileAttrsHooks.mjs +37 -0
- package/es/index.d.ts +5 -0
- package/es/index.mjs +44 -21
- package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
- package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render.controller.d.ts +93 -0
- package/es/interface/index.d.ts +12 -0
- package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
- package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
- package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
- package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
- package/es/interface/state/i-design-render-base.state.d.ts +19 -0
- package/es/interface/state/i-design-render-container.state.d.ts +11 -0
- package/es/interface/state/i-design-render-item.state.d.ts +11 -0
- package/es/interface/state/i-design-render.state.d.ts +18 -0
- package/es/loader.d.ts +1 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +2 -0
- package/es/register/node/node.register.d.ts +92 -0
- package/es/register/node/node.register.mjs +116 -0
- package/es/register/render-register/render-register.mjs +63 -58
- package/es/state/design-render/design-render.state.d.ts +13 -0
- package/es/state/design-render/design-render.state.mjs +15 -0
- package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
- package/es/state/design-render-base/design-render-base.state.mjs +6 -0
- package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
- package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
- package/es/state/index.d.ts +4 -0
- package/es/utils/cacheAdapter.mjs +62 -54
- package/es/utils/expression/index.d.ts +1 -1
- package/es/utils/expression/index.mjs +105 -122
- package/es/utils/expression/regularExpression/methods.mjs +426 -567
- package/es/utils/field-attrs/basicAttrs.mjs +56 -80
- package/es/utils/field-attrs/index.mjs +16 -13
- package/es/utils/get-ref-data.mjs +41 -59
- package/es/utils/getFieldSchema.mjs +66 -80
- package/es/utils/index.d.ts +6 -3
- package/es/utils/index.mjs +12 -0
- package/es/utils/model-transformer.mjs +74 -64
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
- package/es/utils/search/index.d.ts +3 -0
- package/es/utils/search/index.mjs +3 -0
- package/es/utils/search/listhook.d.ts +17 -0
- package/es/utils/search/listhook.mjs +70 -0
- package/es/utils/search/search-default-value.d.ts +7 -0
- package/es/utils/search/search-default-value.mjs +244 -0
- package/es/utils/search/search-hooks.d.ts +6 -0
- package/es/utils/search/search-hooks.mjs +67 -0
- package/es/utils/useStyle.d.ts +2 -2
- package/es/utils/useStyle.mjs +20 -15
- package/package.json +21 -17
- package/dist/index.esm.min.mjs +0 -7758
- package/dist/index.min.cjs +0 -9
- package/dist/index.system.min.js +0 -9
package/es/Event/baseEvent.mjs
CHANGED
|
@@ -1,445 +1,389 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
for (const k in fromProp) {
|
|
365
|
-
toProps[k] = fromProp[k];
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
/**获取组件的属性 */
|
|
369
|
-
$getPropsByKey(key, PropsKey = [], root) {
|
|
370
|
-
const widget = this.gctWidgets[key];
|
|
371
|
-
if (!widget) return {};
|
|
372
|
-
const props = root || !widget.props ? widget : widget.props;
|
|
373
|
-
if (typeof PropsKey === "string") {
|
|
374
|
-
PropsKey = [PropsKey];
|
|
375
|
-
}
|
|
376
|
-
return PropsKey.reduce((pre, curr) => {
|
|
377
|
-
pre[curr] = props[curr];
|
|
378
|
-
return pre;
|
|
379
|
-
}, {});
|
|
380
|
-
}
|
|
381
|
-
/**全局loading */
|
|
382
|
-
$loading;
|
|
383
|
-
}
|
|
384
|
-
class GctComponent {
|
|
385
|
-
modelKey;
|
|
386
|
-
getValue;
|
|
387
|
-
setValue;
|
|
388
|
-
/**提交 */
|
|
389
|
-
submit;
|
|
390
|
-
/**刷新 */
|
|
391
|
-
reload;
|
|
392
|
-
key;
|
|
393
|
-
constructor(key, options) {
|
|
394
|
-
this.key = key;
|
|
395
|
-
const elRef = options.elRef;
|
|
396
|
-
Object.keys(elRef).forEach((k) => {
|
|
397
|
-
this[k] = elRef[k];
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
1
|
+
import { transformData, transformSourceData } from "../utils/model-transformer.mjs";
|
|
2
|
+
import { Globals } from "./utils/runGlobalByPage.mjs";
|
|
3
|
+
import { $httpBizService, $request, BizService } from "./bizServiceRequest.mjs";
|
|
4
|
+
import { globalLoading } from "./utils/globalLoading.mjs";
|
|
5
|
+
import { ProcessAppRovedData } from "./utils/processRovedInfo.mjs";
|
|
6
|
+
import "../utils/index.mjs";
|
|
7
|
+
import { FormComponents, INNER_EVENT, t } from "@gct-paas/core";
|
|
8
|
+
import dayjs from "dayjs";
|
|
9
|
+
import * as _ from "lodash-es";
|
|
10
|
+
import { cloneDeep, differenceBy } from "lodash-es";
|
|
11
|
+
import BigNumberJS from "bignumber.js";
|
|
12
|
+
import { useStyleTag } from "@vueuse/core";
|
|
13
|
+
import { toRaw } from "vue";
|
|
14
|
+
//#region src/Event/baseEvent.ts
|
|
15
|
+
var Events = class {
|
|
16
|
+
context;
|
|
17
|
+
searchVNodes;
|
|
18
|
+
cssData;
|
|
19
|
+
pageKey;
|
|
20
|
+
exports;
|
|
21
|
+
#Oberver;
|
|
22
|
+
#VNodes;
|
|
23
|
+
/**流程信息 */
|
|
24
|
+
ProcessAppRoved;
|
|
25
|
+
pageLayoutMode;
|
|
26
|
+
constructor({ js, css, pageKey, ContextVm }) {
|
|
27
|
+
this.cssData = this.#createCss(css);
|
|
28
|
+
/**
|
|
29
|
+
* 绑定外部搜索的表格组件
|
|
30
|
+
*/
|
|
31
|
+
this.searchVNodes = {};
|
|
32
|
+
/**
|
|
33
|
+
* 存放所有公共事件函数
|
|
34
|
+
*/
|
|
35
|
+
this.exports = {};
|
|
36
|
+
/**
|
|
37
|
+
* 当前页面所有组件key和事件对象
|
|
38
|
+
*/
|
|
39
|
+
this.#VNodes = {};
|
|
40
|
+
/**
|
|
41
|
+
* 组件订阅中心
|
|
42
|
+
*/
|
|
43
|
+
this.#Oberver = {};
|
|
44
|
+
this.context = new ContextVm({
|
|
45
|
+
$ref: this.getComponent.bind(this),
|
|
46
|
+
$asyncRef: this.getSyncComponent.bind(this)
|
|
47
|
+
});
|
|
48
|
+
this.#createFunction(js);
|
|
49
|
+
Globals.setContextByKey(this.context, pageKey);
|
|
50
|
+
this.pageKey = pageKey;
|
|
51
|
+
}
|
|
52
|
+
/**初始化流程节点信息 */
|
|
53
|
+
async runProcessBySaskId({ taskId, processInstanceId, examineAndApproveState, refFormId }) {
|
|
54
|
+
this.ProcessAppRoved = new ProcessAppRovedData({
|
|
55
|
+
taskId,
|
|
56
|
+
processInstanceId,
|
|
57
|
+
examineAndApproveState,
|
|
58
|
+
refFormId
|
|
59
|
+
});
|
|
60
|
+
await this.ProcessAppRoved.readyProcess();
|
|
61
|
+
}
|
|
62
|
+
#createCss(str, attr = {}) {
|
|
63
|
+
if (!str) return;
|
|
64
|
+
const { css, load, unload } = useStyleTag(str, attr);
|
|
65
|
+
return {
|
|
66
|
+
css,
|
|
67
|
+
load,
|
|
68
|
+
unload
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**保存所有组件的props*/
|
|
72
|
+
runContext(key, widget) {
|
|
73
|
+
this.context.gctWidgets[key] = widget;
|
|
74
|
+
}
|
|
75
|
+
/**触发内置事件 */
|
|
76
|
+
async runEventByName(eventName, events = {}, ...arg) {
|
|
77
|
+
const E = events[eventName];
|
|
78
|
+
let data;
|
|
79
|
+
if (!E) return;
|
|
80
|
+
if (Array.isArray(E)) data = await builtInEvents(E, this.context, arg);
|
|
81
|
+
else {
|
|
82
|
+
const fun = this.exports[E.name];
|
|
83
|
+
if (!fun) throw `函数${E.name}不存在`;
|
|
84
|
+
data = await fun(...arg, toRaw(E.extraParams));
|
|
85
|
+
}
|
|
86
|
+
return data;
|
|
87
|
+
}
|
|
88
|
+
/**执行公共函数事件 */
|
|
89
|
+
async runExportByName(eventName, ...arg) {
|
|
90
|
+
try {
|
|
91
|
+
const fun = this.exports[eventName];
|
|
92
|
+
if (!fun) throw `函数${eventName}不存在`;
|
|
93
|
+
return fun(...arg);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error(error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**异步执行公共函数事件 */
|
|
99
|
+
async runAsyncExportByName(eventName, ...arg) {
|
|
100
|
+
try {
|
|
101
|
+
const fun = this.exports[eventName];
|
|
102
|
+
if (!fun) throw `函数${eventName}不存在`;
|
|
103
|
+
await this.getReadyByFun(fun);
|
|
104
|
+
return fun(...arg);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error(error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
#createFunction(jsJSON) {
|
|
110
|
+
if (!jsJSON) return;
|
|
111
|
+
try {
|
|
112
|
+
new Function("exports", "CTX", jsJSON)(this.exports, this.context);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error(error, "createFunction");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
initNode(key, options) {
|
|
118
|
+
if (key) {
|
|
119
|
+
this.#VNodes[key] = options;
|
|
120
|
+
this.#publish(key, options);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**组件销毁 */
|
|
124
|
+
destroyNode(key) {
|
|
125
|
+
delete this.#VNodes[key];
|
|
126
|
+
delete this.#Oberver[key];
|
|
127
|
+
}
|
|
128
|
+
initSearchs(key, callback, comId) {
|
|
129
|
+
if (!key) return;
|
|
130
|
+
if (this.searchVNodes[key]) {
|
|
131
|
+
/**添加 comId 组件标识 处理显隐藏控制引起的 重复注册回调函数的问题*/
|
|
132
|
+
const item = this.searchVNodes[key].find((i) => i.comId === comId);
|
|
133
|
+
if (item) item.callback = callback;
|
|
134
|
+
else this.searchVNodes[key].push({
|
|
135
|
+
callback,
|
|
136
|
+
comId
|
|
137
|
+
});
|
|
138
|
+
} else this.searchVNodes[key] = [{
|
|
139
|
+
callback,
|
|
140
|
+
comId
|
|
141
|
+
}];
|
|
142
|
+
}
|
|
143
|
+
cancelInitSearchs(key, comId) {
|
|
144
|
+
if (!key || !this.searchVNodes[key]) return;
|
|
145
|
+
this.searchVNodes[key] = this.searchVNodes[key].filter((i) => i.comId !== comId);
|
|
146
|
+
if (this.searchVNodes[key].length === 0) delete this.searchVNodes[key];
|
|
147
|
+
}
|
|
148
|
+
runTableBySearch(key, data) {
|
|
149
|
+
(this.searchVNodes[key] || []).forEach(({ callback }) => callback(data));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 组件初始化订阅
|
|
153
|
+
* @param {*} key 组件唯一key
|
|
154
|
+
* @param {*} eventName 事件名称
|
|
155
|
+
*/
|
|
156
|
+
#subscribeready(key, callback) {
|
|
157
|
+
const options = this.#VNodes[key];
|
|
158
|
+
if (options) callback(key, options);
|
|
159
|
+
else if (this.#Oberver[key]) this.#Oberver[key].push(callback);
|
|
160
|
+
else this.#Oberver[key] = [callback];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* @param key 执行回调
|
|
165
|
+
*/
|
|
166
|
+
#publish(key, options) {
|
|
167
|
+
if (this.#Oberver[key]) this.#Oberver[key].forEach((fun) => {
|
|
168
|
+
fun(options);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 获取组件公用方法 getComponent(identity),根据组件唯一标识获取组件。
|
|
173
|
+
* @param {*} key
|
|
174
|
+
* @returns
|
|
175
|
+
*/
|
|
176
|
+
getComponent(key) {
|
|
177
|
+
const options = this.#VNodes[key];
|
|
178
|
+
if (options) return new GctComponent(key, options);
|
|
179
|
+
console.error(key + "组件不存在或者未初始化");
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 获取组件公用方法 getComponent(identity),根据组件唯一标识获取组件。
|
|
183
|
+
* @param {*} key
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
getSyncComponent(key) {
|
|
187
|
+
if (!key) return Promise.reject("标识不能为空");
|
|
188
|
+
const options = this.#VNodes[key];
|
|
189
|
+
if (options) return Promise.resolve(new GctComponent(key, options));
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
const timer = setTimeout(() => {
|
|
192
|
+
reject(key + "不存在或者被隐藏");
|
|
193
|
+
}, 3e4);
|
|
194
|
+
this.#subscribeready(key, (options) => {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
resolve(new GctComponent(key, options));
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 指定函数中使用到的组件初始化后才执行
|
|
202
|
+
* @param fun
|
|
203
|
+
* @returns
|
|
204
|
+
*/
|
|
205
|
+
async getReadyByFun(fun) {
|
|
206
|
+
if (typeof fun !== "function") return Promise.reject("参数必须是函数");
|
|
207
|
+
const P = String(fun).match(/\$ref\((["'A-Za-z0-9_-]+)\)/g)?.map((i) => {
|
|
208
|
+
const key = i.match(/\$ref\(['|"]([A-Za-z0-9_-]+)['|"]\)/)?.[1];
|
|
209
|
+
return this.getSyncComponent(key);
|
|
210
|
+
}) || [];
|
|
211
|
+
await Promise.all(P);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 流程处理
|
|
215
|
+
* @param processDateValue
|
|
216
|
+
* @param data
|
|
217
|
+
*/
|
|
218
|
+
async processHandle(data, { opinion, reassignId, signature, countersignUserIds, button }) {
|
|
219
|
+
const { taskId, processInstanceId } = this.ProcessAppRoved;
|
|
220
|
+
const processData = {
|
|
221
|
+
procInstId: processInstanceId,
|
|
222
|
+
data,
|
|
223
|
+
opinion,
|
|
224
|
+
button,
|
|
225
|
+
countersignUserIds,
|
|
226
|
+
taskId,
|
|
227
|
+
signature,
|
|
228
|
+
reassignId
|
|
229
|
+
};
|
|
230
|
+
await _gct.api.apaas.pmProcessEngine.postProcExecute(processData);
|
|
231
|
+
}
|
|
232
|
+
/**流程审批校验 */
|
|
233
|
+
async checkedProcess(formProcessId) {
|
|
234
|
+
const { processId } = this.ProcessAppRoved || {};
|
|
235
|
+
if (!processId) return Promise.reject(t("sys.process.pleaseInitiateTheProcessFirst"));
|
|
236
|
+
if (formProcessId !== processId) return Promise.reject(t("sys.process.processInstanceMismatch"));
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
/**作用域 上下文 */
|
|
240
|
+
var Context = class {
|
|
241
|
+
/**根据key获取当前组件 */
|
|
242
|
+
$ref;
|
|
243
|
+
/**根据key异步获取获取组件 */
|
|
244
|
+
$asyncRef;
|
|
245
|
+
/**根据id获取模态框 */
|
|
246
|
+
$getModal;
|
|
247
|
+
/**关闭当前上下文模态框 */
|
|
248
|
+
$closeModal;
|
|
249
|
+
/**调用第三方服务 */
|
|
250
|
+
$customBizService = BizService;
|
|
251
|
+
/**组件id和widget 的map */
|
|
252
|
+
gctWidgets = {};
|
|
253
|
+
constructor({ $ref, $asyncRef }) {
|
|
254
|
+
this.$asyncRef = $asyncRef;
|
|
255
|
+
this.$ref = $ref;
|
|
256
|
+
}
|
|
257
|
+
/**ctx 下的工具函数 */
|
|
258
|
+
$utility = {
|
|
259
|
+
_,
|
|
260
|
+
cloneDeep,
|
|
261
|
+
differenceBy,
|
|
262
|
+
dayjs,
|
|
263
|
+
BigNumber: BigNumberJS,
|
|
264
|
+
plus(a, b) {
|
|
265
|
+
return new BigNumberJS(a).plus(new BigNumberJS(b)).toNumber();
|
|
266
|
+
},
|
|
267
|
+
minus(a, b) {
|
|
268
|
+
return new BigNumberJS(a).minus(new BigNumberJS(b)).toNumber();
|
|
269
|
+
},
|
|
270
|
+
multipliedBy(a, b) {
|
|
271
|
+
return new BigNumberJS(a).multipliedBy(new BigNumberJS(b)).toNumber();
|
|
272
|
+
},
|
|
273
|
+
div(a, b) {
|
|
274
|
+
return new BigNumberJS(a).div(new BigNumberJS(b)).toNumber();
|
|
275
|
+
},
|
|
276
|
+
transformSourceData,
|
|
277
|
+
transformData
|
|
278
|
+
};
|
|
279
|
+
$httpBizService = $httpBizService;
|
|
280
|
+
$request = $request;
|
|
281
|
+
/**全局loading */
|
|
282
|
+
$loading = globalLoading;
|
|
283
|
+
$getPremission(id) {
|
|
284
|
+
return Globals.getPremission(id);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
*
|
|
288
|
+
* @param key 组件权限标识
|
|
289
|
+
* @param id 组件id
|
|
290
|
+
*/
|
|
291
|
+
$setPremission(key, id) {
|
|
292
|
+
Globals.setPremission(key, id);
|
|
293
|
+
}
|
|
294
|
+
/**获取应用全局变量 */
|
|
295
|
+
$getAppGlobalVar(id) {
|
|
296
|
+
return Globals.getGlobalVar(id);
|
|
297
|
+
}
|
|
298
|
+
/**设置应用全局变量 */
|
|
299
|
+
$setAppGlobalVar(id, value) {
|
|
300
|
+
Globals.setGlobalVar(id, value);
|
|
301
|
+
}
|
|
302
|
+
/**获取页面全局变量老版本兼容问题暂时不删除 后续不维护*/
|
|
303
|
+
$getPageGlobalVar(id) {
|
|
304
|
+
return Globals.getPageGlobalVar(id);
|
|
305
|
+
}
|
|
306
|
+
/**设置页面变量老版本 兼容问题暂时不删除 后续不维护 */
|
|
307
|
+
$setPageGlobalVar(id, value) {
|
|
308
|
+
Globals.setPageGlobalVar(id, value);
|
|
309
|
+
}
|
|
310
|
+
/**获取页面全局变量 */
|
|
311
|
+
$getPageVar(id) {
|
|
312
|
+
return Globals.getPageVar(id);
|
|
313
|
+
}
|
|
314
|
+
/**设置页面全局变量 */
|
|
315
|
+
$setPageVar(id, value) {
|
|
316
|
+
Globals.setPageVar(id, value);
|
|
317
|
+
}
|
|
318
|
+
/**根据模态框id 获取上下文 id不传默认页面上下文*/
|
|
319
|
+
$getCtxById(modalKey) {
|
|
320
|
+
return Globals.getContextByKey(modalKey);
|
|
321
|
+
}
|
|
322
|
+
/**设置组件的属性 */
|
|
323
|
+
$setPropsByKey(key, fromProp) {
|
|
324
|
+
const toProps = this.gctWidgets[key]?.props;
|
|
325
|
+
if (!toProps) return;
|
|
326
|
+
for (const k in fromProp) toProps[k] = fromProp[k];
|
|
327
|
+
}
|
|
328
|
+
/**获取组件的属性 */
|
|
329
|
+
$getPropsByKey(key, PropsKey = [], root) {
|
|
330
|
+
const widget = this.gctWidgets[key];
|
|
331
|
+
if (!widget) return {};
|
|
332
|
+
const props = root || !widget.props ? widget : widget.props;
|
|
333
|
+
if (typeof PropsKey === "string") PropsKey = [PropsKey];
|
|
334
|
+
return PropsKey.reduce((pre, curr) => {
|
|
335
|
+
pre[curr] = props[curr];
|
|
336
|
+
return pre;
|
|
337
|
+
}, {});
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* 获取组件实例公用方法
|
|
342
|
+
*/
|
|
343
|
+
var GctComponent = class {
|
|
344
|
+
modelKey;
|
|
345
|
+
getValue;
|
|
346
|
+
setValue;
|
|
347
|
+
/**提交 */
|
|
348
|
+
submit;
|
|
349
|
+
/**刷新 */
|
|
350
|
+
reload;
|
|
351
|
+
key;
|
|
352
|
+
constructor(key, options) {
|
|
353
|
+
this.key = key;
|
|
354
|
+
const elRef = options.elRef;
|
|
355
|
+
Object.keys(elRef).forEach((k) => {
|
|
356
|
+
this[k] = elRef[k];
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* 执行内置事件
|
|
362
|
+
* @param eventList
|
|
363
|
+
*/
|
|
401
364
|
async function builtInEvents(eventList, context, args) {
|
|
402
|
-
|
|
403
|
-
|
|
365
|
+
const allEvent = eventList.map(transformEventFun.bind(context, args));
|
|
366
|
+
await Promise.all(allEvent);
|
|
404
367
|
}
|
|
405
368
|
async function transformEventFun(args, item) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
if (name === INNER_EVENT.CLOSE_MODAL) {
|
|
421
|
-
if (refId) {
|
|
422
|
-
await this.$getModal(refId).close();
|
|
423
|
-
} else {
|
|
424
|
-
await this.$closeModal();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
if (name === INNER_EVENT.REFRESH_TABLE) {
|
|
428
|
-
const com = await this.$getCtxById(scopeId).$asyncRef(refId);
|
|
429
|
-
await com.reload(args ? args[0] : null);
|
|
430
|
-
}
|
|
369
|
+
const { name, refId, scopeId, modalTitle } = item;
|
|
370
|
+
const ids = modalTitle?.split(".") || [];
|
|
371
|
+
let widget;
|
|
372
|
+
if (ids.length > 1) {
|
|
373
|
+
const orgWidget = this.gctWidgets?.[ids[0]] || {};
|
|
374
|
+
const opes = [];
|
|
375
|
+
getAllOpe(opes, orgWidget);
|
|
376
|
+
widget = opes.find((i) => i.id === ids[1]) || {};
|
|
377
|
+
} else if (ids.length) widget = this.gctWidgets?.[ids[0]];
|
|
378
|
+
if (name === INNER_EVENT.OPEN_MODAL) await this.$getModal(refId).open({ title: widget?.props?.title });
|
|
379
|
+
if (name === INNER_EVENT.CLOSE_MODAL) if (refId) await this.$getModal(refId).close();
|
|
380
|
+
else await this.$closeModal();
|
|
381
|
+
if (name === INNER_EVENT.REFRESH_TABLE) await (await this.$getCtxById(scopeId).$asyncRef(refId)).reload(args ? args[0] : null);
|
|
431
382
|
}
|
|
432
383
|
function getAllOpe(arr, widget) {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
arr.push(i);
|
|
437
|
-
} else {
|
|
438
|
-
if (i.children?.length) {
|
|
439
|
-
getAllOpe(arr, i);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
384
|
+
const children = widget.children || [];
|
|
385
|
+
for (const i of children) if (i.type && i.type == FormComponents.CustomButton) arr.push(i);
|
|
386
|
+
else if (i.children?.length) getAllOpe(arr, i);
|
|
443
387
|
}
|
|
444
|
-
|
|
445
|
-
export { Context, Events };
|
|
388
|
+
//#endregion
|
|
389
|
+
export { Context, Events, GctComponent };
|