resolver-egretimp-plus 0.0.79 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.79",
3
+ "version": "0.0.81",
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,26 +2,49 @@ 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
+ import { buildInRequest } from "../../utils/request"
6
7
 
7
- export async function dispatchClickEvents ({serviceList = [], requestTraceId, axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
8
+ function assignmentPatchVal(obj = {}, path, val) {
9
+ let paths = path
10
+ if (typeof path === 'string') {
11
+ paths = path.split('.')
12
+ }
13
+ let currentObj = obj
14
+ paths.forEach((item, idx) => {
15
+ if (idx + 1 === paths.length) {
16
+ currentObj[item] = val
17
+ } else {
18
+ if (!currentObj[item]) {
19
+ currentObj[item] = {}
20
+ }
21
+ currentObj = currentObj[item]
22
+ }
23
+ })
24
+ }
25
+
26
+ export async function dispatchClickEvents ({serviceList = [], requestTraceId, axiosInstance, dialogReq, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService}) {
8
27
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
9
28
  const mixinServiceConfig = serviceList.find(service => service.serviceType === '1')
10
29
  for (let i = 0; i < serviceList.length; i++) {
11
30
  const service = serviceList[i]
12
- dispatchClickEvent(service, {dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance})
31
+ dispatchClickEvent(service, {dynamicMapComp, requestTraceId, dialogReq, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService})
13
32
  }
14
33
  }
15
34
 
16
- export async function dispatchClickEvent(service, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance }) {
35
+ export async function dispatchClickEvent(service, { dynamicMapComp, requestTraceId, dialogReq, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance, beforeRequestService, afterRequestService }) {
17
36
  let reqData = rootValue || {}
18
37
  let tableConfig = null
19
38
  if (service.transactionType == '1') {
20
39
  reqData = getReqData(service.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
21
40
  tableConfig = getTableConfig(service.outParamMappingList, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat })
22
41
  if (tableConfig?.vm) {
23
- reqData[service.pageNum || 'pageNum'] = tableConfig.vm.page?.pageNum
24
- reqData[service.pageSize || 'pageSize'] = tableConfig.vm.page?.pageSize
42
+ assignmentPatchVal(reqData, service.pageNum || 'pageNum', tableConfig.vm.page?.pageNum)
43
+ assignmentPatchVal(reqData, service.pageSize || 'pageSize', tableConfig.vm.page?.pageSize)
44
+ }
45
+ reqData = {
46
+ ...reqData,
47
+ // ...dialogReq
25
48
  }
26
49
  }
27
50
  const url = service.serviceCode
@@ -36,6 +59,25 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
36
59
  },
37
60
  ...reqData
38
61
  }
62
+
63
+ let beforeRequestServiceRet = true
64
+ if (beforeRequestService) {
65
+ beforeRequestServiceRet = beforeRequestService({
66
+ dynamicMapComp,
67
+ requestTraceId,
68
+ mixinServiceConfig,
69
+ rootValue,
70
+ dynamicHireRelat,
71
+ compConfig,
72
+ service,
73
+ reqData: reqResult
74
+ })
75
+ }
76
+ const beforeRequestServiceRetValid = await beforeRequestServiceRet
77
+ if (!beforeRequestServiceRetValid) {
78
+ return
79
+ }
80
+
39
81
  const reqConfig = {
40
82
  url,
41
83
  method: httpMethod,
@@ -46,6 +88,8 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
46
88
  delete reqConfig.data
47
89
  }
48
90
  const ret = await (axiosInstance && axiosInstance(reqConfig))
91
+ afterRequestService && afterRequestService(ret)
92
+
49
93
  if (!resultToast(ret?.data, messageInstance, {messageCb, service, compConfig, noSuccessIip: httpMethod.toLocaleLowerCase() === 'get'})) {
50
94
  await Promise.reject()
51
95
  return
@@ -69,17 +113,19 @@ function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys
69
113
  const configCode = configCodes[0]
70
114
  if (configCode) {
71
115
  const destParamArr = destParam?.split('.') || []
72
- let currentObj = ret
73
- destParamArr.forEach((item, idx) => {
74
- if (idx + 1 === destParamArr.length) {
75
- currentObj[item] = dynamicMapComp[configCode]?.refValue
76
- } else {
77
- if (!currentObj[item]) {
78
- currentObj[item] = {}
79
- }
80
- currentObj = currentObj[item]
81
- }
82
- })
116
+ assignmentPatchVal(ret, destParamArr, dynamicMapComp[configCode]?.refValue)
117
+
118
+ // let currentObj = ret
119
+ // destParamArr.forEach((item, idx) => {
120
+ // if (idx + 1 === destParamArr.length) {
121
+ // currentObj[item] = dynamicMapComp[configCode]?.refValue
122
+ // } else {
123
+ // if (!currentObj[item]) {
124
+ // currentObj[item] = {}
125
+ // }
126
+ // currentObj = currentObj[item]
127
+ // }
128
+ // })
83
129
  }
84
130
  return ret
85
131
  }, {})
@@ -145,6 +191,7 @@ export function openDailg({
145
191
  buttonActions,
146
192
  openChildDialog,
147
193
  appContext,
194
+ compConfig
148
195
  }) {
149
196
  const busiIdentityId = pagePopupMap.popupBusiIdentityId
150
197
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
@@ -209,8 +256,45 @@ export function openDailg({
209
256
  return retItem
210
257
  })
211
258
  }
212
- initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult})
213
- dialogClose?.()
259
+ // 定义的请求中间钩子
260
+ const middleOpenDialog = compConfig?.middleOpenDialog
261
+
262
+ let middleOpenDialogRet = outResult
263
+ if (middleOpenDialog) {
264
+ middleOpenDialogRet = middleOpenDialog({
265
+ dynamicMapComp,
266
+ rootValue,
267
+ dynamicHireRelat,
268
+ compConfig,
269
+ pagePopupMap,
270
+ inputParams: reqData,
271
+ outputParams: outResult
272
+ })
273
+ }
274
+ if (isPromise(middleOpenDialogRet)) {
275
+ middleOpenDialogRet.then(res => {
276
+ toInitOutParams(res)
277
+ })
278
+ } else {
279
+ toInitOutParams(middleOpenDialogRet)
280
+ }
281
+
282
+ function toInitOutParams(outData) {
283
+ initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: outData})
284
+ dialogClose?.()
285
+
286
+ // 定义的请求后钩子
287
+ const afterOpenDialog = compConfig?.afterOpenDialog
288
+ afterOpenDialog && afterOpenDialog({
289
+ dynamicMapComp,
290
+ rootValue,
291
+ dynamicHireRelat,
292
+ compConfig,
293
+ pagePopupMap,
294
+ inputParams: reqData,
295
+ outputParams: outData
296
+ })
297
+ }
214
298
  }
215
299
  }
216
300
  }
@@ -225,43 +309,93 @@ export function openDailg({
225
309
  }
226
310
  }
227
311
  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
312
+
313
+ // 定义的请求前钩子
314
+ const beforeOpenDialog = compConfig?.beforeOpenDialog
315
+ // // 定义的请求后钩子
316
+ // const afterOpenDialog = compConfig?.afterOpenDialog
317
+
318
+ let beforeOpenDialogRet = true
319
+ if (beforeOpenDialog) {
320
+ beforeOpenDialogRet = beforeOpenDialog({
321
+ dynamicMapComp,
322
+ rootValue,
323
+ dynamicHireRelat,
324
+ compConfig,
325
+ pagePopupMap,
326
+ inputParams: reqData
327
+ })
328
+ }
329
+
330
+ if (beforeOpenDialogRet !== null && beforeOpenDialogRet !== undefined) {
331
+ if (isPromise(beforeOpenDialogRet)) {
332
+ beforeOpenDialogRet.then(res => {
333
+ if (res) {
334
+ toOpenDialog()
335
+ }
336
+ })
337
+ } else {
338
+ if (beforeOpenDialogRet) {
339
+ toOpenDialog()
340
+ }
243
341
  }
244
- }, appContext)
342
+ } else {
343
+ toOpenDialog()
344
+ }
345
+
346
+ function toOpenDialog() {
347
+ dialogClose = openChildDialog({
348
+ buttonActions,
349
+ dialogProps,
350
+ parentRootValue: rootValue,
351
+ selectionsObj,
352
+ busiIdentityId,
353
+ axiosInstance: axiosInstance,
354
+ lang,
355
+ loadEvnetsReq: reqData,
356
+ initData: reqData,
357
+ polyfillConfigs: {
358
+ ...initPolyfillConfigs,
359
+ ...(polyfillConfigs || {})
360
+ },
361
+ rootStoreChange: (val) => {
362
+ rootStore = val
363
+ }
364
+ }, appContext)
365
+ }
245
366
  }
246
367
 
247
368
  // 数据校验服务
248
369
  export async function executeDataValid(validConfig, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, axiosInstance, lang}) {
249
370
  let reqData = rootValue || {}
250
371
  const url = DATA_VALID_RULE_EXECUTE
251
- const ret = await (axiosInstance && axiosInstance({
252
- url,
372
+
373
+ const ret = await buildInRequest(url, {
374
+ requestTraceId,
375
+ pmHandleBusinessIdentity: {
376
+ busiIdentityId: validConfig.busiIdentityId,
377
+ pageMetaId: validConfig.pageMetaId,
378
+ tenantId: validConfig.tenantId,
379
+ mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
380
+ },
381
+ ...reqData
382
+ }, {
253
383
  method: "post",
254
- data: {
255
- requestTraceId,
256
- pmHandleBusinessIdentity: {
257
- busiIdentityId: validConfig.busiIdentityId,
258
- pageMetaId: validConfig.pageMetaId,
259
- tenantId: validConfig.tenantId,
260
- mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
261
- },
262
- ...reqData
263
- }
264
- }))
384
+ })
385
+ // const ret = await (axiosInstance && axiosInstance({
386
+ // url,
387
+ // method: "post",
388
+ // data: {
389
+ // requestTraceId,
390
+ // pmHandleBusinessIdentity: {
391
+ // busiIdentityId: validConfig.busiIdentityId,
392
+ // pageMetaId: validConfig.pageMetaId,
393
+ // tenantId: validConfig.tenantId,
394
+ // mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
395
+ // },
396
+ // ...reqData
397
+ // }
398
+ // }))
265
399
  const result = ret.data || {}
266
400
  const resultCode = result.resultCode
267
401
  const resultMessage = result?.resultMessage || ''
@@ -317,7 +451,7 @@ function closePage(lcpPageClosedMapVO) {
317
451
  }
318
452
  }
319
453
 
320
- export async function executeEventOrchestration({props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
454
+ export async function executeEventOrchestration({props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dialogReq, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
321
455
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
322
456
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
323
457
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
@@ -338,6 +472,11 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
338
472
  }
339
473
 
340
474
  if (PageServiceMapVOList?.length) {
475
+ // 定义的请求前钩子
476
+ const beforeRequestService = props.config?.beforeRequestService
477
+ // 定义的请求后钩子
478
+ const afterRequestService = props.config?.afterRequestService
479
+
341
480
  const dynamicHireRelat = props.config?.dynamicHireRelat
342
481
  dispatchClickEvents({
343
482
  serviceList: PageServiceMapVOList,
@@ -348,11 +487,15 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
348
487
  dynamicHireRelat,
349
488
  messageInstance,
350
489
  messageCb,
351
- compConfig: props.config
490
+ compConfig: props.config,
491
+ dialogReq,
492
+ beforeRequestService,
493
+ afterRequestService
352
494
  })
353
495
  }
354
496
  const lcpPagePopupMapVO = props.config.lcpPagePopupMapVO
355
497
  if (lcpPagePopupMapVO) {
498
+
356
499
  const dynamicHireRelat = props.config?.dynamicHireRelat
357
500
  openDailg({
358
501
  rootValue,
@@ -365,7 +508,8 @@ export async function executeEventOrchestration({props, requestTraceId, axiosIns
365
508
  lang,
366
509
  messageCb,
367
510
  buttonActions,
368
- openChildDialog
511
+ openChildDialog,
512
+ compConfig: props.config,
369
513
  })
370
514
  }
371
515
  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'))
@@ -225,7 +225,7 @@ export function extractFunctionBody(funcStr) {
225
225
  }
226
226
 
227
227
  export function isPromise(fn) {
228
- return typeof fn.then === 'function';
228
+ return fn && typeof fn.then === 'function';
229
229
  }
230
230
 
231
231
  export function getDate(...arg) {
@@ -394,6 +394,9 @@ export function getRenderComponentProps({ props, component, modelValue, selects,
394
394
  ...getRenderCompMargins(config),
395
395
  width: commonProps.width || getBuildCompDefaultWidth(config)
396
396
  }
397
+ if (config.hidden === '1') {
398
+ defprops.style.display = 'none'
399
+ }
397
400
 
398
401
  const retObj = {
399
402
  ...defprops,
@@ -643,6 +646,12 @@ function getFormItemExtendProps(config, lang, params) {
643
646
  const prop = config.dynamicHireRelat || ''
644
647
  // const propAttr = config.dynamicHireRelat ? config.dynamicHireRelat?.split('->') : []
645
648
  // const prop = propAttr.join('->')
649
+ const style = {
650
+ ...getFormItemMargins(config)
651
+ }
652
+ if (config.hidden === '1') {
653
+ style.display = 'none'
654
+ }
646
655
  return {
647
656
  prop,
648
657
  rules: getFormItemRule(config, lang, params),
@@ -651,9 +660,7 @@ function getFormItemExtendProps(config, lang, params) {
651
660
  'hidden-label': config.labelWidth == 0 || config.labelWidth === '0px' || config.labelHidden == '1',
652
661
  [`label-position-${config['label-position'] || 'right'}`]: true // label-position 支持三个值,right、left、top
653
662
  },
654
- style: {
655
- ...getFormItemMargins(config)
656
- }
663
+ style,
657
664
  }
658
665
  }
659
666