resolver-egretimp-plus 0.0.95 → 0.0.97

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.95",
3
+ "version": "0.0.97",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -194,7 +194,7 @@ export default {
194
194
  attrs?.onClick?.call(context, e) // 如果配置中有点击事件
195
195
  executeClickEvents({ beforeRequestService, afterRequestService })
196
196
  }
197
- function executeClickEvents({ beforeRequestService, afterRequestService }) {
197
+ function executeClickEvents({ beforeRequestService, afterRequestService } = {}) {
198
198
  executeEventOrchestration({
199
199
  beforeRequestService,
200
200
  afterRequestService,
@@ -368,37 +368,53 @@ export function openDailg({
368
368
  }
369
369
 
370
370
  // 数据校验服务
371
- export async function executeDataValid(validConfig, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, axiosInstance, lang}) {
371
+ export async function executeDataValid(validConfig, {
372
+ beforeRequestService,
373
+ afterRequestService,
374
+ confirmInstance,
375
+ dynamicMapComp,
376
+ requestTraceId,
377
+ compConfig,
378
+ mixinServiceConfig,
379
+ rootValue,
380
+ axiosInstance,
381
+ lang
382
+ }) {
372
383
  let reqData = rootValue || {}
373
384
  const url = DATA_VALID_RULE_EXECUTE
374
385
 
386
+ let beforeRequestServiceRet = true
387
+ if (beforeRequestService) {
388
+ beforeRequestServiceRet = beforeRequestService({
389
+ dynamicMapComp,
390
+ requestTraceId,
391
+ mixinServiceConfig,
392
+ rootValue,
393
+ compConfig,
394
+ service: validConfig,
395
+ reqData: reqData
396
+ })
397
+ }
398
+ const beforeRequestServiceRetValid = await beforeRequestServiceRet
399
+ if (!beforeRequestServiceRetValid) {
400
+ return
401
+ }
375
402
  const ret = await buildInRequest(url, {
376
403
  requestTraceId,
404
+ ...reqData,
377
405
  pmHandleBusinessIdentity: {
378
406
  busiIdentityId: validConfig.busiIdentityId,
379
407
  pageMetaId: validConfig.pageMetaId,
380
408
  tenantId: validConfig.tenantId,
381
409
  mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
382
410
  },
383
- ...reqData
384
411
  }, {
385
412
  method: "post",
386
413
  })
387
- // const ret = await (axiosInstance && axiosInstance({
388
- // url,
389
- // method: "post",
390
- // data: {
391
- // requestTraceId,
392
- // pmHandleBusinessIdentity: {
393
- // busiIdentityId: validConfig.busiIdentityId,
394
- // pageMetaId: validConfig.pageMetaId,
395
- // tenantId: validConfig.tenantId,
396
- // mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
397
- // },
398
- // ...reqData
399
- // }
400
- // }))
401
- const result = ret.data || {}
414
+ let result = ret.data || {}
415
+ if (ret.data?.baseResponse) {
416
+ result = ret.data?.baseResponse
417
+ }
402
418
  const resultCode = result.resultCode
403
419
  const resultMessage = result?.resultMessage || ''
404
420
  let type = ''
@@ -424,24 +440,26 @@ export async function executeDataValid(validConfig, { dynamicMapComp, requestTra
424
440
  type = 'error'
425
441
  break;
426
442
  }
427
- }
428
- // if (validConfig?.validationType === '2') {
429
- // weakFlag = true
430
- // }
431
- return new Promise((resolver, inject) => {
432
- confirmInstance(resultMessage, lang?.indexOf('zh') > -1 ? '提示' : 'Hint', {
433
- type,
434
- showCancelButton: weakFlag
435
- }).then(() => {
436
- if (!weakFlag) {
437
- resolver(false)
438
- } else {
439
- resolver(true)
440
- }
441
- }).catch(() => {
442
- inject(false)
443
+ return new Promise((resolver, inject) => {
444
+ confirmInstance(resultMessage, lang?.indexOf('zh') > -1 ? '提示' : 'Hint', {
445
+ type,
446
+ showCancelButton: weakFlag
447
+ }).then(() => {
448
+ if (!weakFlag) {
449
+ afterRequestService && afterRequestService(ret, {valid: false})
450
+ resolver(false)
451
+ } else {
452
+ afterRequestService && afterRequestService(ret, {valid: true})
453
+ resolver(true)
454
+ }
455
+ }).catch(() => {
456
+ afterRequestService && afterRequestService(ret, {valid: false})
457
+ inject(false)
458
+ })
443
459
  })
444
- })
460
+ }
461
+ afterRequestService && afterRequestService(ret, {valid: true})
462
+ return true
445
463
  }
446
464
 
447
465
  function closePage(lcpPageClosedMapVO) {
@@ -475,26 +493,12 @@ export async function executeEventOrchestration({
475
493
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
476
494
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
477
495
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
478
- if (lcpPageRuleVOLis?.length && mixinServiceConfig) {
479
- // 数据校验服务
480
- const validConfig = lcpPageRuleVOLis[0]
481
- const valid = await executeDataValid(validConfig, {
482
- dynamicMapComp,
483
- requestTraceId,
484
- rootValue,
485
- axiosInstance,
486
- mixinServiceConfig,
487
- lang
488
- })
489
- if (!valid) {
490
- return
491
- }
492
- }
493
-
494
- if (PageServiceMapVOList?.length) {
496
+
497
+ let normalBeforeRequestService = null
498
+ let normalAfterRequestService = null
499
+ if ((lcpPageRuleVOLis?.length) || PageServiceMapVOList?.length) {
495
500
  // 定义的请求前钩子
496
501
  const configBeforeRequestService = props.config?.beforeRequestService
497
- let normalBeforeRequestService = null
498
502
  if (configBeforeRequestService || beforeRequestService) {
499
503
  normalBeforeRequestService = async (...arg) => {
500
504
  let ret = true
@@ -510,14 +514,34 @@ export async function executeEventOrchestration({
510
514
  }
511
515
  // 定义的请求后钩子
512
516
  const configAfterRequestService = props.config?.afterRequestService
513
- let normalAfterRequestService = null
514
517
  if (configAfterRequestService || afterRequestService) {
515
518
  normalAfterRequestService = (...arg) => {
516
519
  afterRequestService?.(...arg)
517
520
  configAfterRequestService?.(...arg)
518
521
  }
519
522
  }
520
-
523
+ }
524
+ if (lcpPageRuleVOLis?.length) {
525
+ // 数据校验服务
526
+ const validConfig = lcpPageRuleVOLis[0]
527
+ const valid = await executeDataValid(validConfig, {
528
+ dynamicMapComp,
529
+ requestTraceId,
530
+ rootValue,
531
+ axiosInstance,
532
+ mixinServiceConfig,
533
+ compConfig: props.config,
534
+ confirmInstance,
535
+ beforeRequestService: normalBeforeRequestService,
536
+ afterRequestService: normalAfterRequestService,
537
+ lang
538
+ })
539
+ if (!valid) {
540
+ return
541
+ }
542
+ }
543
+
544
+ if (PageServiceMapVOList?.length) {
521
545
  const dynamicHireRelat = props.config?.dynamicHireRelat
522
546
  dispatchClickEvents({
523
547
  serviceList: PageServiceMapVOList,
@@ -31,7 +31,7 @@ const tableProps = computed(() => {
31
31
  })
32
32
  const page = reactive({
33
33
  pageNum: 1,
34
- pageSize: props.config?.pageSize || 10,
34
+ pageSize: props.config?.pageSize || 3,
35
35
  total: 0,
36
36
  })
37
37
 
@@ -5,9 +5,6 @@ export default function defaultVal(config) {
5
5
  if ((config.defaultVal || config.defaultValue) && !config.bindValue && config.bindValue !== 0) {
6
6
  const configDefaultVal = config.defaultVal || config.defaultValue
7
7
  let defaultVal = null
8
- if (config.metaCode === 'custId') {
9
- debugger
10
- }
11
8
  try {
12
9
  if (/^{\w*}$/.test(configDefaultVal) || /^\[\w*\]$/.test(configDefaultVal)) {
13
10
  defaultVal = JSON.parse(configDefaultVal)