resolver-egretimp-plus 0.0.234 → 0.0.236

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.234",
3
+ "version": "0.0.236",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -1,9 +1,19 @@
1
1
  import rulesDriver from "../../rules/rulesDriver"
2
2
  import { penddingRules } from "../../rules/ruleUtils"
3
- import { hasOwn } from "../../utils"
3
+ import { hasOwn, isPlainObject } from "../../utils"
4
4
  import { resultToast } from "../../utils/respone"
5
5
 
6
- export async function executeLoadServices(services = [], { alongLoad, requestTraceId, businessIdentityReqData = {}, axiosInstance, messageInstance, reqData, respCb, notLoadCb }) {
6
+ export async function executeLoadServices(services = [], {
7
+ alongLoad,
8
+ requestTraceId,
9
+ businessIdentityReqData = {},
10
+ axiosInstance,
11
+ messageInstance,
12
+ reqData,
13
+ respCb,
14
+ loadEventsBefore,
15
+ notLoadCb
16
+ }) {
7
17
  if (!alongLoad && reqData?.notLoad) {
8
18
  notLoadCb && notLoadCb()
9
19
  return
@@ -33,7 +43,7 @@ export async function executeLoadServices(services = [], { alongLoad, requestTra
33
43
  },
34
44
  ...(reqData || {})
35
45
  }
36
- const reqConfig = {
46
+ let reqConfig = {
37
47
  url,
38
48
  method: httpMethod,
39
49
  data: reqResult
@@ -42,6 +52,31 @@ export async function executeLoadServices(services = [], { alongLoad, requestTra
42
52
  reqConfig.params = reqResult
43
53
  delete reqConfig.data
44
54
  }
55
+
56
+ if (loadEventsBefore && typeof loadEventsBefore === 'function') {
57
+ let beforeRequestRet = true
58
+ if (loadEventsBefore) {
59
+ beforeRequestRet = loadEventsBefore({
60
+ reqConfig,
61
+ })
62
+ }
63
+ if (beforeRequestRet !== null && beforeRequestRet !== undefined) {
64
+ if (isPromise(beforeRequestRet)) {
65
+ beforeRequestRet = await beforeRequestRet
66
+ if (beforeRequestRet === false) {
67
+ return
68
+ }
69
+ if (isPlainObject(beforeRequestRet)) {
70
+ reqConfig = beforeRequestRet
71
+ }
72
+ } else {
73
+ if (beforeRequestRet === false) {
74
+ console.warn('请求中断')
75
+ return
76
+ }
77
+ }
78
+ }
79
+ }
45
80
 
46
81
  const ret = await (axiosInstance.value && axiosInstance.value(reqConfig))
47
82
  if (resultToast(ret.data, messageInstance, { noSuccessIip: true })) {
package/src/index.jsx CHANGED
@@ -105,6 +105,10 @@ export default {
105
105
  type: Function,
106
106
  default: null
107
107
  },
108
+ loadEventsBefore: {
109
+ type: Function,
110
+ default: null
111
+ },
108
112
  // 在弹框里面的页面,通过弹窗传染的请求数据
109
113
  dialogReq: {
110
114
  type: Object,
@@ -191,6 +195,13 @@ export default {
191
195
  notLoadCb: () => {
192
196
  nativeDataLoad.value = true
193
197
  },
198
+ loadEventsBefore: ({
199
+ reqConfig,
200
+ }) => {
201
+ if (props.loadEventsBefore && typeof props.loadEventsBefore === 'function') {
202
+ return props.loadEventsAfter({reqConfig})
203
+ }
204
+ },
194
205
  respCb: (result) => {
195
206
  let val = result
196
207
  if (props.loadEventsAfter && typeof props.loadEventsAfter === 'function') {
@@ -67,6 +67,8 @@ const allInitEvents = {
67
67
  if (val === ARG_FLAGS.REF_VAL) {
68
68
  const { config } = this
69
69
  val = config?.bindValue ?? ''
70
+ } else if(val === ARG_FLAGS.CURRENT_DATE) {
71
+ val = formatDate(new Date(), 'yyyy-MM-dd')
70
72
  } else {
71
73
  let routeMatchs = null
72
74
  const _absoluteTarget = /^_absoluteTarget:(.+)$/
@@ -106,10 +108,10 @@ const allInitEvents = {
106
108
  configs.forEach(labelInfo => {
107
109
  if (!labelInfo) return
108
110
  let val = ''
109
- if (valArrTypes.includes(labelInfo.labelType)) {
111
+ if (valArrTypes.includes(labelInfo.metaType || labelInfo.labelType)) {
110
112
  val = []
111
113
  }
112
- if (valBooleanTypes.includes(labelInfo.labelType)) {
114
+ if (valBooleanTypes.includes(labelInfo.metaType || labelInfo.labelType)) {
113
115
  val = false
114
116
  }
115
117
  hasOwn(labelInfo, 'refValue') && (labelInfo.refValue = val)