resolver-egretimp-plus 0.0.79 → 0.0.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -48,6 +48,7 @@ export default {
48
48
  delete ret.onClick
49
49
  return ret
50
50
  })
51
+ const dialogReq = inject('_dialogReq', {})
51
52
  const requestTraceId = inject('requestTraceId')
52
53
  const polyfillConfigs = inject('_polyfillConfigs', {})
53
54
  const buttonActions = inject('buttonActions', {})
@@ -202,6 +203,7 @@ export default {
202
203
  messageCb,
203
204
  buttonActions,
204
205
  lang: lang?.value,
206
+ dialogReq,
205
207
  appContext
206
208
  })
207
209
  }
@@ -4,13 +4,15 @@ import { createVNode, render } from 'vue'
4
4
  let instance = null
5
5
 
6
6
  export function openChildDialog(options = {}, appContext) {
7
+ const initData = options.initData || {}
7
8
  if (instance) {
8
9
  Object.keys(options).forEach(key => {
9
10
  instance.props[key] = options[key]
10
11
 
11
- instance.vm.exposed.dialogVisible.value = true
12
12
  })
13
- instance?.vm?.exposed?.clearData()
13
+ instance.vm.exposed.dialogVisible.value = true
14
+ // instance?.vm?.exposed?.clearData()
15
+ instance?.vm?.exposed?.initData(initData)
14
16
  return instance.close
15
17
  }
16
18
  const container = document.createElement('div')
@@ -30,5 +32,7 @@ export function openChildDialog(options = {}, appContext) {
30
32
  }
31
33
  }
32
34
  vnode.component.exposed.dialogVisible.value = true
35
+ vnode.component.exposed?.initData(initData)
36
+
33
37
  return instance.close
34
38
  }
@@ -81,6 +81,9 @@ defineExpose({
81
81
  dialogVisible,
82
82
  clearData: () => {
83
83
  formData.value = {}
84
+ },
85
+ initData: (data) => {
86
+ formData.value = data
84
87
  }
85
88
  })
86
89
  </script>
@@ -101,7 +104,7 @@ defineExpose({
101
104
  :busiIdentityId="busiIdentityId"
102
105
  :lang="props.lang"
103
106
  :buttonActions="props.buttonActions"
104
- :loadEvnetsReq="props.loadEvnetsReq"
107
+ :dialogReq="props.loadEvnetsReq"
105
108
  :polyfillConfigs="props.polyfillConfigs"
106
109
  :axiosInstance="props.axiosInstance"
107
110
  :axiosConfig="props.axiosConfig"
@@ -2,18 +2,18 @@ import { isArray, isHasVal } from "../../utils/is"
2
2
  import { DATA_VALID_RULE_EXECUTE } from "../../api/builtIn"
3
3
  import { getRelateConfigKeys } from "../../rules/ruleUtils"
4
4
  import { RESULT_CODE, resultToast } from "../../utils/respone"
5
- import { parseExtendAttr, unionWith } from "../../utils/index"
5
+ import { isPromise, parseExtendAttr, unionWith } from "../../utils/index"
6
6
 
7
- export async function dispatchClickEvents ({serviceList = [], requestTraceId, axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
7
+ export async function dispatchClickEvents ({serviceList = [], requestTraceId, axiosInstance, dialogReq, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService}) {
8
8
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
9
9
  const mixinServiceConfig = serviceList.find(service => service.serviceType === '1')
10
10
  for (let i = 0; i < serviceList.length; i++) {
11
11
  const service = serviceList[i]
12
- dispatchClickEvent(service, {dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance})
12
+ dispatchClickEvent(service, {dynamicMapComp, requestTraceId, dialogReq, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService})
13
13
  }
14
14
  }
15
15
 
16
- export async function dispatchClickEvent(service, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance }) {
16
+ export async function dispatchClickEvent(service, { dynamicMapComp, requestTraceId, dialogReq, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService }) {
17
17
  let reqData = rootValue || {}
18
18
  let tableConfig = null
19
19
  if (service.transactionType == '1') {
@@ -23,6 +23,10 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
23
23
  reqData[service.pageNum || 'pageNum'] = tableConfig.vm.page?.pageNum
24
24
  reqData[service.pageSize || 'pageSize'] = tableConfig.vm.page?.pageSize
25
25
  }
26
+ reqData = {
27
+ ...reqData,
28
+ // ...dialogReq
29
+ }
26
30
  }
27
31
  const url = service.serviceCode
28
32
  const httpMethod = service.httpMethod || "post"
@@ -36,6 +40,25 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
36
40
  },
37
41
  ...reqData
38
42
  }
43
+
44
+ let beforeRequestServiceRet = true
45
+ if (beforeRequestService) {
46
+ beforeRequestServiceRet = beforeRequestService({
47
+ dynamicMapComp,
48
+ requestTraceId,
49
+ mixinServiceConfig,
50
+ rootValue,
51
+ dynamicHireRelat,
52
+ compConfig,
53
+ service,
54
+ reqData: reqResult
55
+ })
56
+ }
57
+ const beforeRequestServiceRetValid = await beforeRequestServiceRet
58
+ if (!beforeRequestServiceRetValid) {
59
+ return
60
+ }
61
+
39
62
  const reqConfig = {
40
63
  url,
41
64
  method: httpMethod,
@@ -46,6 +69,8 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
46
69
  delete reqConfig.data
47
70
  }
48
71
  const ret = await (axiosInstance && axiosInstance(reqConfig))
72
+ afterRequestService && afterRequestService(ret)
73
+
49
74
  if (!resultToast(ret?.data, messageInstance, {messageCb, service, compConfig, noSuccessIip: httpMethod.toLocaleLowerCase() === 'get'})) {
50
75
  await Promise.reject()
51
76
  return
@@ -145,6 +170,7 @@ export function openDailg({
145
170
  buttonActions,
146
171
  openChildDialog,
147
172
  appContext,
173
+ compConfig
148
174
  }) {
149
175
  const busiIdentityId = pagePopupMap.popupBusiIdentityId
150
176
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
@@ -209,8 +235,45 @@ export function openDailg({
209
235
  return retItem
210
236
  })
211
237
  }
212
- initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult})
213
- dialogClose?.()
238
+ // 定义的请求中间钩子
239
+ const middleOpenDialog = compConfig?.middleOpenDialog
240
+
241
+ let middleOpenDialogRet = outResult
242
+ if (middleOpenDialog) {
243
+ middleOpenDialogRet = middleOpenDialog({
244
+ dynamicMapComp,
245
+ rootValue,
246
+ dynamicHireRelat,
247
+ compConfig,
248
+ pagePopupMap,
249
+ inputParams: reqData,
250
+ outputParams: outResult
251
+ })
252
+ }
253
+ if (isPromise(middleOpenDialogRet)) {
254
+ middleOpenDialogRet.then(res => {
255
+ toInitOutParams(res)
256
+ })
257
+ } else {
258
+ toInitOutParams(middleOpenDialogRet)
259
+ }
260
+
261
+ function toInitOutParams(outData) {
262
+ initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: outData})
263
+ dialogClose?.()
264
+
265
+ // 定义的请求后钩子
266
+ const afterOpenDialog = compConfig?.afterOpenDialog
267
+ afterOpenDialog && afterOpenDialog({
268
+ dynamicMapComp,
269
+ rootValue,
270
+ dynamicHireRelat,
271
+ compConfig,
272
+ pagePopupMap,
273
+ inputParams: reqData,
274
+ outputParams: outData
275
+ })
276
+ }
214
277
  }
215
278
  }
216
279
  }
@@ -225,23 +288,60 @@ export function openDailg({
225
288
  }
226
289
  }
227
290
  const dialogProps = parseExtendAttr({extendAttr: pagePopupMap.extendAttr})
228
- dialogClose = openChildDialog({
229
- buttonActions,
230
- dialogProps,
231
- parentRootValue: rootValue,
232
- selectionsObj,
233
- busiIdentityId,
234
- axiosInstance: axiosInstance,
235
- lang,
236
- loadEvnetsReq: reqData,
237
- polyfillConfigs: {
238
- ...initPolyfillConfigs,
239
- ...(polyfillConfigs || {})
240
- },
241
- rootStoreChange: (val) => {
242
- rootStore = val
291
+
292
+ // 定义的请求前钩子
293
+ const beforeOpenDialog = compConfig?.beforeOpenDialog
294
+ // // 定义的请求后钩子
295
+ // const afterOpenDialog = compConfig?.afterOpenDialog
296
+
297
+ let beforeOpenDialogRet = true
298
+ if (beforeOpenDialog) {
299
+ beforeOpenDialogRet = beforeOpenDialog({
300
+ dynamicMapComp,
301
+ rootValue,
302
+ dynamicHireRelat,
303
+ compConfig,
304
+ pagePopupMap,
305
+ inputParams: reqData
306
+ })
307
+ }
308
+
309
+ if (beforeOpenDialogRet !== null && beforeOpenDialogRet !== undefined) {
310
+ if (isPromise(beforeOpenDialogRet)) {
311
+ beforeOpenDialogRet.then(res => {
312
+ if (res) {
313
+ toOpenDialog()
314
+ }
315
+ })
316
+ } else {
317
+ if (beforeOpenDialogRet) {
318
+ toOpenDialog()
319
+ }
243
320
  }
244
- }, appContext)
321
+ } else {
322
+ toOpenDialog()
323
+ }
324
+
325
+ function toOpenDialog() {
326
+ dialogClose = openChildDialog({
327
+ buttonActions,
328
+ dialogProps,
329
+ parentRootValue: rootValue,
330
+ selectionsObj,
331
+ busiIdentityId,
332
+ axiosInstance: axiosInstance,
333
+ lang,
334
+ loadEvnetsReq: reqData,
335
+ initData: reqData,
336
+ polyfillConfigs: {
337
+ ...initPolyfillConfigs,
338
+ ...(polyfillConfigs || {})
339
+ },
340
+ rootStoreChange: (val) => {
341
+ rootStore = val
342
+ }
343
+ }, appContext)
344
+ }
245
345
  }
246
346
 
247
347
  // 数据校验服务
@@ -317,7 +417,7 @@ function closePage(lcpPageClosedMapVO) {
317
417
  }
318
418
  }
319
419
 
320
- export async function executeEventOrchestration({props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
420
+ export async function executeEventOrchestration({props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dialogReq, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
321
421
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
322
422
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
323
423
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
@@ -338,6 +438,11 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
338
438
  }
339
439
 
340
440
  if (PageServiceMapVOList?.length) {
441
+ // 定义的请求前钩子
442
+ const beforeRequestService = props.config?.beforeRequestService
443
+ // 定义的请求后钩子
444
+ const afterRequestService = props.config?.afterRequestService
445
+
341
446
  const dynamicHireRelat = props.config?.dynamicHireRelat
342
447
  dispatchClickEvents({
343
448
  serviceList: PageServiceMapVOList,
@@ -348,11 +453,15 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
348
453
  dynamicHireRelat,
349
454
  messageInstance,
350
455
  messageCb,
351
- compConfig: props.config
456
+ compConfig: props.config,
457
+ dialogReq,
458
+ beforeRequestService,
459
+ afterRequestService
352
460
  })
353
461
  }
354
462
  const lcpPagePopupMapVO = props.config.lcpPagePopupMapVO
355
463
  if (lcpPagePopupMapVO) {
464
+
356
465
  const dynamicHireRelat = props.config?.dynamicHireRelat
357
466
  openDailg({
358
467
  rootValue,
@@ -365,7 +474,8 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
365
474
  lang,
366
475
  messageCb,
367
476
  buttonActions,
368
- openChildDialog
477
+ openChildDialog,
478
+ compConfig: props.config,
369
479
  })
370
480
  }
371
481
  const lcpPageClosedMapVO = props.config.lcpPageClosedMapVO
package/src/index.jsx CHANGED
@@ -99,6 +99,11 @@ export default {
99
99
  type: Object,
100
100
  default: () => ({})
101
101
  },
102
+ // 在弹框里面的页面,通过弹窗传染的请求数据
103
+ dialogReq: {
104
+ type: Object,
105
+ default: () => ({})
106
+ },
102
107
  // 加载服务中businessIdentity的额外参数
103
108
  businessIdentityReqData: {
104
109
  type: Object,
@@ -166,7 +171,7 @@ export default {
166
171
  requestTraceId: props.requestTraceId,
167
172
  messageInstance: toRef(props, 'messageInstance'),
168
173
  axiosInstance,
169
- reqData: props.loadEvnetsReq,
174
+ reqData: {...props.loadEvnetsReq, ...props.dialogReq},
170
175
  respCb: (result) => {
171
176
  nativeDataLoad.value = true
172
177
  const val = deepMerge(props.modelValue, result, 'replace')
@@ -196,7 +201,7 @@ export default {
196
201
  messageInstance: toRef(props, 'messageInstance'),
197
202
  businessIdentityReqData: props.businessIdentityReqData,
198
203
  axiosInstance,
199
- reqData: props.loadEvnetsReq,
204
+ reqData: {...props.loadEvnetsReq, ...props.dialogReq},
200
205
  respCb: (result) => {
201
206
  nativeDataLoad.value = true
202
207
  const val = deepMerge(props.modelValue, result, 'replace')
@@ -206,6 +211,7 @@ export default {
206
211
  }
207
212
  )
208
213
  })
214
+ provide('_dialogReq', props.dialogReq)
209
215
  provide('_messageCb', props.messageCb)
210
216
  provide('_rootStore', rootStore)
211
217
  provide('_openChildDialogInstance', toRef(props, 'openChildDialogInstance'))