resolver-egretimp-plus 0.1.118 → 0.1.119
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/const/index.js +1 -1
- package/dist/h5/index.js +16 -16
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/hooks/watchRuels.js +20 -9
- package/src/index.jsx +2 -0
- package/src/rulesOfDate/eventsSupplement.js +168 -136
- package/src/rulesOfDate/parseCondition.js +0 -1
- package/src/rulesOfDate/ruleUtils.js +65 -36
- package/src/rulesOfDate/rulesDriver.js +3 -1
- package/src/utils/common.js +56 -6
- package/src/utils/render.jsx +2 -2
package/package.json
CHANGED
package/src/hooks/watchRuels.js
CHANGED
|
@@ -6,7 +6,9 @@ export function toWatchRules({
|
|
|
6
6
|
rules,
|
|
7
7
|
rootValue,
|
|
8
8
|
mapComp,
|
|
9
|
+
dynamicMapComp,
|
|
9
10
|
route,
|
|
11
|
+
messageInstance,
|
|
10
12
|
lang,
|
|
11
13
|
}) {
|
|
12
14
|
const ruleKeys = Object.keys(rules)
|
|
@@ -33,6 +35,7 @@ export function toWatchRules({
|
|
|
33
35
|
rulesDriver({
|
|
34
36
|
rules: rules[originKey],
|
|
35
37
|
mapComp,
|
|
38
|
+
dynamicMapComp,
|
|
36
39
|
rootValue,
|
|
37
40
|
route,
|
|
38
41
|
lang,
|
|
@@ -47,7 +50,11 @@ export function toWatchRules({
|
|
|
47
50
|
function watchRuleTrace({comps, rootValue, watchCb}, prefix = '', idx = 0, unWatchsList = []) {
|
|
48
51
|
if (comps && comps.length) {
|
|
49
52
|
const comp = comps[idx]
|
|
50
|
-
|
|
53
|
+
try {
|
|
54
|
+
prefix += prefix ? `->${comp.metaCode}` : comp.metaCode
|
|
55
|
+
} catch (error) {
|
|
56
|
+
debugger
|
|
57
|
+
}
|
|
51
58
|
if (comps.length === (idx + 1)) {
|
|
52
59
|
const unWatch = watch(() => getPathVal(unref(rootValue), prefix, '->'), (val) => {
|
|
53
60
|
// 开始执行规则
|
|
@@ -72,17 +79,21 @@ function watchRuleTrace({comps, rootValue, watchCb}, prefix = '', idx = 0, unWat
|
|
|
72
79
|
const childUnWatchs = []
|
|
73
80
|
unWatchsList.push(childUnWatchs)
|
|
74
81
|
const currentPrefix = `${prefix}[${index}]`
|
|
75
|
-
idx
|
|
76
|
-
watchRuleTrace({comps, rootValue, watchCb}, currentPrefix,
|
|
82
|
+
const currentIdx = idx + 1
|
|
83
|
+
watchRuleTrace({comps, rootValue, watchCb}, currentPrefix, currentIdx, [...unWatchsList])
|
|
77
84
|
_rowMapWatchs.set(row, {key: currentPrefix, childUnWatchs})
|
|
78
85
|
}
|
|
79
86
|
})
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
try {
|
|
88
|
+
const mapKeys = _rowMapWatchs.keys()
|
|
89
|
+
Array.from(mapKeys).forEach(row => {
|
|
90
|
+
if (!list.some(row2 => row2 === row)) {
|
|
91
|
+
_rowMapWatchs.get(row)?.childUnWatchs?.forEach(un => un?.())
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
} catch (error) {
|
|
95
|
+
debugger
|
|
96
|
+
}
|
|
86
97
|
}, {
|
|
87
98
|
immediate: true
|
|
88
99
|
})
|
package/src/index.jsx
CHANGED
|
@@ -413,7 +413,9 @@ export default {
|
|
|
413
413
|
// rules: hireRelatMapRulesRef.value,
|
|
414
414
|
// rootValue: toRef(props, 'modelValue'),
|
|
415
415
|
// mapComp: mapCompRef.value,
|
|
416
|
+
// dynamicMapComp,
|
|
416
417
|
// route,
|
|
418
|
+
// messageInstance: props.messageInstance,
|
|
417
419
|
// lang: props.lang,
|
|
418
420
|
// })
|
|
419
421
|
onMounted(() => {
|
|
@@ -30,6 +30,7 @@ import { ARG_FLAGS, MULTI_PAGE_META_LIST_TYPES } from '../utils/const'
|
|
|
30
30
|
// import { commModal } from '../../../common/components/cmi/components/comm-modal-tip/index'
|
|
31
31
|
import { findComponent, formatDate, getPathVal, hasOwn, isPlainObject, parseExtendAttr } from '../utils/index';
|
|
32
32
|
import { unref } from 'vue';
|
|
33
|
+
import { assignmentPathVal } from '../utils';
|
|
33
34
|
const valArrTypes = [...MULTI_PAGE_META_LIST_TYPES]
|
|
34
35
|
const valBooleanTypes = []
|
|
35
36
|
|
|
@@ -127,7 +128,7 @@ const allInitEvents = {
|
|
|
127
128
|
if (matchs) {
|
|
128
129
|
val = matchs?.[1]
|
|
129
130
|
} else {
|
|
130
|
-
const curVal = getConfigValue
|
|
131
|
+
const curVal = getConfigValue(unref(rootValue), targetObj, currentPath)
|
|
131
132
|
if (curVal || curVal == '0') {
|
|
132
133
|
val = curVal
|
|
133
134
|
}
|
|
@@ -148,11 +149,11 @@ const allInitEvents = {
|
|
|
148
149
|
setFormVal(targetObj, '', mapComp, rootValue, currentPath)
|
|
149
150
|
|
|
150
151
|
},
|
|
151
|
-
setDisable({event, rootValue, mapComp, currentPath, isInit}) {
|
|
152
|
+
setDisable({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
152
153
|
const { targetObj: target } = event
|
|
153
154
|
if (!target) return
|
|
154
155
|
const targetObj = `${target}`
|
|
155
|
-
const configs = getCurrentComp
|
|
156
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
156
157
|
configs.forEach(labelInfo => {
|
|
157
158
|
labelInfo && (labelInfo.editFlag = '0')
|
|
158
159
|
})
|
|
@@ -163,30 +164,29 @@ const allInitEvents = {
|
|
|
163
164
|
})
|
|
164
165
|
}
|
|
165
166
|
},
|
|
166
|
-
setDisableNotEffect(event,
|
|
167
|
+
setDisableNotEffect({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
167
168
|
const { targetObj: target } = event
|
|
168
169
|
if (!target) return
|
|
169
|
-
const targetObj = `${
|
|
170
|
-
const configs = getCurrentComp
|
|
171
|
-
const oldEditFlags = []
|
|
170
|
+
const targetObj = `${target}`
|
|
171
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
172
172
|
configs.forEach(labelInfo => {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
if (!hasOwn(labelInfo, '_originEditFlag')) {
|
|
174
|
+
labelInfo._originEditFlag = labelInfo.editFlag
|
|
175
|
+
}
|
|
175
176
|
labelInfo && (labelInfo.editFlag = '0')
|
|
176
177
|
})
|
|
177
178
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
178
179
|
return () => {
|
|
179
180
|
configs.forEach((labelInfo, idx) => {
|
|
180
|
-
|
|
181
|
-
labelInfo && (labelInfo.editFlag = oldEditFlag)
|
|
181
|
+
labelInfo && (labelInfo.editFlag = labelInfo._originEditFlag)
|
|
182
182
|
})
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
setRequired(event,
|
|
185
|
+
setRequired({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
186
186
|
const { targetObj: target } = event
|
|
187
187
|
if (!target) return
|
|
188
|
-
const targetObj = `${
|
|
189
|
-
const configs = getCurrentComp
|
|
188
|
+
const targetObj = `${target}`
|
|
189
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
190
190
|
configs.forEach(labelInfo => {
|
|
191
191
|
labelInfo && (labelInfo.requiredFlag = '1')
|
|
192
192
|
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '1')
|
|
@@ -196,103 +196,114 @@ const allInitEvents = {
|
|
|
196
196
|
return () => {
|
|
197
197
|
configs.forEach(labelInfo => {
|
|
198
198
|
labelInfo && (labelInfo.requiredFlag = '0')
|
|
199
|
-
|
|
199
|
+
if (labelInfo.isColumn) {
|
|
200
|
+
// 表格列的必填设置,需要判断所有列是否都不是必填的
|
|
201
|
+
const pmPageMetaList = labelInfo?.parent?.pmPageMetaList || []
|
|
202
|
+
const multiPmPageMetaList = labelInfo?.parent?.multiPmPageMetaList || []
|
|
203
|
+
const idx = pmPageMetaList?.findIndex(cg => cg.metaCode === labelInfo.metaCode)
|
|
204
|
+
if (multiPmPageMetaList?.every(columns => columns[idx]?.requiredFlag == '0')) {
|
|
205
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '0')
|
|
206
|
+
}
|
|
207
|
+
}
|
|
200
208
|
})
|
|
201
209
|
}
|
|
202
210
|
},
|
|
203
|
-
setRequiredNotEffect(event,
|
|
211
|
+
setRequiredNotEffect({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
204
212
|
const { targetObj: target } = event
|
|
205
213
|
if (!target) return
|
|
206
|
-
const targetObj = `${
|
|
207
|
-
const configs = getCurrentComp
|
|
214
|
+
const targetObj = `${target}`
|
|
215
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
208
216
|
|
|
209
|
-
const oldRequiredFlags = []
|
|
210
217
|
configs.forEach(labelInfo => {
|
|
211
|
-
|
|
212
|
-
|
|
218
|
+
if (!hasOwn(labelInfo, '_originRequiredFlag')) {
|
|
219
|
+
labelInfo._originRequiredFlag = labelInfo.requiredFlag
|
|
220
|
+
}
|
|
213
221
|
labelInfo && (labelInfo.requiredFlag = '1')
|
|
214
222
|
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '1')
|
|
215
223
|
})
|
|
216
224
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
217
225
|
return () => {
|
|
218
226
|
configs.forEach((labelInfo, idx) => {
|
|
219
|
-
|
|
220
|
-
labelInfo &&
|
|
221
|
-
|
|
227
|
+
labelInfo && (labelInfo.requiredFlag = labelInfo._originRequiredFlag)
|
|
228
|
+
if (labelInfo.isColumn && labelInfo._originRequiredFlag == '0') {
|
|
229
|
+
// 表格列的必填设置,需要判断所有列是否都不是必填的
|
|
230
|
+
const pmPageMetaList = labelInfo?.parent?.pmPageMetaList || []
|
|
231
|
+
const multiPmPageMetaList = labelInfo?.parent?.multiPmPageMetaList || []
|
|
232
|
+
const idx = pmPageMetaList?.findIndex(cg => cg.metaCode === labelInfo.metaCode)
|
|
233
|
+
if (multiPmPageMetaList?.every(columns => columns[idx]?.requiredFlag == '0')) {
|
|
234
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = labelInfo._originRequiredFlag)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
222
237
|
})
|
|
223
238
|
}
|
|
224
239
|
},
|
|
225
|
-
setHidden(event,
|
|
240
|
+
setHidden({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
226
241
|
const { targetObj: target } = event
|
|
227
242
|
if (!target) return
|
|
228
|
-
const targetObj = `${
|
|
229
|
-
const configs = getCurrentComp
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// const oldDisplayType = labelInfo && labelInfo.displayType
|
|
235
|
-
// oldDisplayTypes.push(oldDisplayType)
|
|
236
|
-
// 兼容开始使用displayType用于显示隐藏的配置
|
|
237
|
-
labelInfo && /^\d+$/.test(labelInfo.displayType) && (labelInfo.displayType = '0')
|
|
238
|
-
labelInfo && (labelInfo.hidden = '1')
|
|
239
|
-
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.displayType = '0')
|
|
243
|
+
const targetObj = `${target}`
|
|
244
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
245
|
+
|
|
246
|
+
configs.forEach(labelInfo => {
|
|
247
|
+
labelInfo && (labelInfo.hidden = '1')
|
|
248
|
+
if (labelInfo.isColumn) {
|
|
240
249
|
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.hidden = '1')
|
|
241
|
-
}
|
|
242
|
-
}
|
|
250
|
+
}
|
|
251
|
+
})
|
|
243
252
|
|
|
244
253
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
245
254
|
return () => {
|
|
246
255
|
configs.forEach((labelInfo, idx) => {
|
|
247
|
-
// const oldDisplayType = oldDisplayTypes[idx]
|
|
248
|
-
labelInfo && /^\d+$/.test(labelInfo.displayType) && (labelInfo.displayType = '1')
|
|
249
256
|
labelInfo && (labelInfo.hidden = '0')
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
if (labelInfo.isColumn) {
|
|
258
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.hidden = '0')
|
|
259
|
+
}
|
|
252
260
|
})
|
|
253
261
|
}
|
|
254
262
|
},
|
|
255
|
-
setShow(event,
|
|
263
|
+
setShow({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
256
264
|
const { targetObj: target } = event
|
|
257
265
|
if (!target) return
|
|
258
|
-
const targetObj = `${
|
|
259
|
-
const configs = getCurrentComp
|
|
260
|
-
// const oldDisplayTypes = []
|
|
266
|
+
const targetObj = `${target}`
|
|
267
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
261
268
|
configs.forEach((labelInfo) => {
|
|
262
|
-
// const oldDisplayType = labelInfo && labelInfo.displayType
|
|
263
|
-
// oldDisplayTypes.push(oldDisplayType)
|
|
264
|
-
labelInfo && /^\d+$/.test(labelInfo.displayType) && (labelInfo.displayType = '1')
|
|
265
269
|
labelInfo && (labelInfo.hidden = '0')
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
if (labelInfo.isColumn) {
|
|
271
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.hidden = '0')
|
|
272
|
+
}
|
|
268
273
|
})
|
|
269
274
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
270
275
|
return () => {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
// const oldDisplayType = oldDisplayTypes[idx]
|
|
275
|
-
labelInfo && /^\d+$/.test(labelInfo.displayType) && (labelInfo.displayType = '0')
|
|
276
|
-
labelInfo && (labelInfo.hidden = '1')
|
|
277
|
-
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.displayType = '0')
|
|
276
|
+
configs.forEach((labelInfo, idx) => {
|
|
277
|
+
labelInfo && (labelInfo.hidden = '1')
|
|
278
|
+
if (labelInfo.isColumn) {
|
|
278
279
|
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.hidden = '1')
|
|
279
|
-
}
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
|
+
})
|
|
281
282
|
}
|
|
282
283
|
},
|
|
283
|
-
setNoRequired(event,
|
|
284
|
+
setNoRequired({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
284
285
|
const { targetObj: target } = event
|
|
285
286
|
if (!target) return
|
|
286
|
-
const targetObj = `${
|
|
287
|
-
const configs = getCurrentComp
|
|
288
|
-
|
|
287
|
+
const targetObj = `${target}`
|
|
288
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
289
|
+
|
|
289
290
|
const callFns = []
|
|
290
291
|
configs.forEach(labelInfo => {
|
|
291
292
|
if (labelInfo && labelInfo.requiredFlag != '0') {
|
|
292
293
|
labelInfo && (labelInfo.requiredFlag = '0')
|
|
294
|
+
if (labelInfo.isColumn) {
|
|
295
|
+
// 表格列的必填设置,需要判断所有列是否都不是必填的
|
|
296
|
+
const pmPageMetaList = labelInfo?.parent?.pmPageMetaList || []
|
|
297
|
+
const multiPmPageMetaList = labelInfo?.parent?.multiPmPageMetaList || []
|
|
298
|
+
const idx = pmPageMetaList?.findIndex(cg => cg.metaCode === labelInfo.metaCode)
|
|
299
|
+
if (multiPmPageMetaList?.every(columns => columns[idx]?.requiredFlag == '0')) {
|
|
300
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '0')
|
|
301
|
+
}
|
|
302
|
+
}
|
|
293
303
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
294
304
|
callFns.push(() => {
|
|
295
305
|
labelInfo && (labelInfo.requiredFlag = '1')
|
|
306
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '1')
|
|
296
307
|
})
|
|
297
308
|
}
|
|
298
309
|
})
|
|
@@ -300,66 +311,102 @@ const allInitEvents = {
|
|
|
300
311
|
callFns.forEach(fn => fn())
|
|
301
312
|
}
|
|
302
313
|
},
|
|
303
|
-
setNoRequiredNotEffect(event,
|
|
314
|
+
setNoRequiredNotEffect({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
304
315
|
const { targetObj: target } = event
|
|
305
316
|
if (!target) return
|
|
306
|
-
const targetObj = `${
|
|
307
|
-
const configs = getCurrentComp
|
|
317
|
+
const targetObj = `${target}`
|
|
318
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
308
319
|
|
|
309
|
-
const
|
|
320
|
+
const callFns = []
|
|
310
321
|
configs.forEach(labelInfo => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
322
|
+
if (labelInfo && labelInfo.requiredFlag != '0') {
|
|
323
|
+
if (!hasOwn(labelInfo, '_originRequiredFlag')) {
|
|
324
|
+
labelInfo._originRequiredFlag = labelInfo.requiredFlag
|
|
325
|
+
}
|
|
326
|
+
labelInfo && (labelInfo.requiredFlag = '0')
|
|
327
|
+
|
|
328
|
+
if (labelInfo.isColumn) {
|
|
329
|
+
// 表格列的必填设置,需要判断所有列是否都不是必填的
|
|
330
|
+
const pmPageMetaList = labelInfo?.parent?.pmPageMetaList || []
|
|
331
|
+
const multiPmPageMetaList = labelInfo?.parent?.multiPmPageMetaList || []
|
|
332
|
+
const idx = pmPageMetaList?.findIndex(cg => cg.metaCode === labelInfo.metaCode)
|
|
333
|
+
if (multiPmPageMetaList?.every(columns => columns[idx]?.requiredFlag == '0')) {
|
|
334
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = '0')
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
339
|
+
callFns.push(() => {
|
|
340
|
+
labelInfo && (labelInfo.requiredFlag = labelInfo._originRequiredFlag)
|
|
341
|
+
if (labelInfo._originRequiredFlag == '0') {
|
|
342
|
+
if (labelInfo.isColumn) {
|
|
343
|
+
// 表格列的必填设置,需要判断所有列是否都不是必填的
|
|
344
|
+
const pmPageMetaList = labelInfo?.parent?.pmPageMetaList || []
|
|
345
|
+
const multiPmPageMetaList = labelInfo?.parent?.multiPmPageMetaList || []
|
|
346
|
+
const idx = pmPageMetaList?.findIndex(cg => cg.metaCode === labelInfo.metaCode)
|
|
347
|
+
if (multiPmPageMetaList?.every(columns => columns[idx]?.requiredFlag == '0')) {
|
|
348
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = labelInfo._originRequiredFlag)
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
labelInfo && labelInfo.refConfig && (labelInfo.refConfig.requiredFlag = labelInfo._originRequiredFlag)
|
|
353
|
+
}
|
|
354
|
+
})
|
|
355
|
+
}
|
|
314
356
|
})
|
|
315
357
|
|
|
316
358
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
317
359
|
return () => {
|
|
318
|
-
|
|
319
|
-
const oldRequiredFlag = oldRequiredFlags[idx]
|
|
320
|
-
labelInfo && (labelInfo.requiredFlag = oldRequiredFlag)
|
|
321
|
-
})
|
|
360
|
+
callFns.forEach(fn => fn())
|
|
322
361
|
}
|
|
323
362
|
},
|
|
324
|
-
setNoDisable(event,
|
|
363
|
+
setNoDisable({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
325
364
|
const { targetObj: target } = event
|
|
326
365
|
if (!target) return
|
|
327
|
-
const targetObj = `${
|
|
328
|
-
const configs = getCurrentComp
|
|
366
|
+
const targetObj = `${target}`
|
|
367
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
368
|
+
|
|
369
|
+
const callFns = []
|
|
329
370
|
configs.forEach((labelInfo) => {
|
|
330
|
-
|
|
371
|
+
if (labelInfo?.editFlag != '1') {
|
|
372
|
+
labelInfo && (labelInfo.editFlag = '1')
|
|
373
|
+
callFns.push(() => {
|
|
374
|
+
labelInfo && (labelInfo.editFlag = '0')
|
|
375
|
+
})
|
|
376
|
+
}
|
|
331
377
|
})
|
|
332
378
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
333
379
|
return () => {
|
|
334
|
-
|
|
335
|
-
labelInfo && (labelInfo.editFlag = '0')
|
|
336
|
-
})
|
|
380
|
+
callFns.forEach(fn => fn())
|
|
337
381
|
}
|
|
338
382
|
},
|
|
339
|
-
setNoDisableNotEffect(event,
|
|
383
|
+
setNoDisableNotEffect({event, rootValue, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
340
384
|
const { targetObj: target } = event
|
|
341
385
|
if (!target) return
|
|
342
|
-
const targetObj = `${
|
|
343
|
-
const configs = getCurrentComp
|
|
344
|
-
|
|
386
|
+
const targetObj = `${target}`
|
|
387
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
388
|
+
|
|
389
|
+
const callFns = []
|
|
345
390
|
configs.forEach((labelInfo) => {
|
|
346
|
-
|
|
347
|
-
|
|
391
|
+
if (!hasOwn(labelInfo, '_originEditFlag')) {
|
|
392
|
+
labelInfo._originEditFlag = labelInfo.editFlag
|
|
393
|
+
}
|
|
348
394
|
labelInfo && (labelInfo.editFlag = '1')
|
|
395
|
+
|
|
396
|
+
callFns.push(() => {
|
|
397
|
+
labelInfo && (labelInfo.editFlag = labelInfo._originEditFlag)
|
|
398
|
+
})
|
|
349
399
|
})
|
|
350
400
|
|
|
351
401
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
352
402
|
return () => {
|
|
353
|
-
|
|
354
|
-
const oldEditFlag = oldEditFlags[idx]
|
|
355
|
-
labelInfo && (labelInfo.editFlag = oldEditFlag)
|
|
356
|
-
})
|
|
403
|
+
callFns.forEach(fn => fn())
|
|
357
404
|
}
|
|
358
405
|
},
|
|
359
|
-
limitDataRange(event,
|
|
406
|
+
limitDataRange({event, rootValue, mapComp, dynamicMapComp, currentPath, messageInstance, isInit}) {
|
|
360
407
|
const { targetObj: target, targetObjVal = '' } = event
|
|
361
408
|
if (!target) return
|
|
362
|
-
const targetObj = `${
|
|
409
|
+
const targetObj = `${target}`
|
|
363
410
|
let range = []
|
|
364
411
|
if (targetObjVal?.indexOf('~') > -1) {
|
|
365
412
|
range = targetObjVal.split('~')
|
|
@@ -367,14 +414,12 @@ const allInitEvents = {
|
|
|
367
414
|
range = targetObjVal.split(',')
|
|
368
415
|
}
|
|
369
416
|
if (range && range.length) {
|
|
370
|
-
const
|
|
371
|
-
const configs = getCurrentComp.call(this, targetObj)
|
|
417
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
372
418
|
configs.forEach(config => {
|
|
373
419
|
let updateFlag = false
|
|
374
420
|
const oldProps = {}
|
|
375
|
-
|
|
421
|
+
config._eventLimitDataRageCbProps = oldProps
|
|
376
422
|
if (!config) return
|
|
377
|
-
const { config: currentConfig } = this
|
|
378
423
|
let val = ''
|
|
379
424
|
if (findComponent(['ElDatePicker'], config?.renderby || config?.metaType) !== -1) {
|
|
380
425
|
const min = range[0]
|
|
@@ -383,9 +428,9 @@ const allInitEvents = {
|
|
|
383
428
|
val = parseExtendAttr(
|
|
384
429
|
{
|
|
385
430
|
extendAttr: JSON.stringify({min, max}),
|
|
386
|
-
metaCode: `event
|
|
431
|
+
metaCode: `event setPorps code, target path: ${currentPath}`
|
|
387
432
|
},
|
|
388
|
-
|
|
433
|
+
getPathVal(unref(rootValue), currentPath, '->')
|
|
389
434
|
)
|
|
390
435
|
} catch (err) {
|
|
391
436
|
val = ''
|
|
@@ -396,20 +441,21 @@ const allInitEvents = {
|
|
|
396
441
|
val = parseExtendAttr(
|
|
397
442
|
{
|
|
398
443
|
extendAttr: JSON.stringify({rangeOptions: range}),
|
|
399
|
-
metaCode: `event
|
|
444
|
+
metaCode: `event setPorps code, target path: ${currentPath}`
|
|
400
445
|
},
|
|
401
|
-
|
|
446
|
+
getPathVal(unref(rootValue), currentPath, '->')
|
|
402
447
|
)
|
|
403
448
|
} catch (err) {
|
|
404
449
|
val = ''
|
|
405
450
|
}
|
|
406
451
|
} else {
|
|
407
|
-
const currentVal =
|
|
452
|
+
const currentVal = getPathVal(unref(rootValue), config.dynamicHireRelat, '->')
|
|
408
453
|
if (min && lessThan(currentVal, min)) {
|
|
409
|
-
|
|
454
|
+
|
|
455
|
+
assignmentPathVal(rootValue, config.dynamicHireRelat, min, '->')
|
|
410
456
|
}
|
|
411
457
|
if (max && greaterThan(currentVal, max)) {
|
|
412
|
-
|
|
458
|
+
assignmentPathVal(rootValue, config.dynamicHireRelat, max, '->')
|
|
413
459
|
}
|
|
414
460
|
return
|
|
415
461
|
}
|
|
@@ -423,8 +469,7 @@ const allInitEvents = {
|
|
|
423
469
|
updateFlag = true
|
|
424
470
|
}
|
|
425
471
|
if ((typeof val[key]) === 'string') {
|
|
426
|
-
const
|
|
427
|
-
const bindValue = currentConfig?.bindValue
|
|
472
|
+
const bindValue = getPathVal(unref(rootValue), currentPath, '->')
|
|
428
473
|
config[key] = val[key].replace(/\{([^}]+)\}/g, (originVal, matchVal) => {
|
|
429
474
|
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.REF_VAL) {
|
|
430
475
|
return bindValue
|
|
@@ -443,51 +488,43 @@ const allInitEvents = {
|
|
|
443
488
|
}
|
|
444
489
|
})
|
|
445
490
|
return () => {
|
|
446
|
-
// 需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
447
|
-
// return setTimeout(() => {
|
|
448
491
|
configs.forEach((labelInfo, idx) => {
|
|
449
|
-
const oldProps =
|
|
492
|
+
const oldProps = labelInfo._eventLimitDataRageCbProps
|
|
450
493
|
if (!labelInfo) return
|
|
451
494
|
const porpsKeys = Object.keys(oldProps)
|
|
452
495
|
porpsKeys.forEach(key => {
|
|
453
496
|
labelInfo[key] = oldProps[key]
|
|
454
497
|
})
|
|
455
498
|
})
|
|
456
|
-
// }, 0)
|
|
457
499
|
}
|
|
458
500
|
}
|
|
459
501
|
},
|
|
460
|
-
setPopup(event,
|
|
502
|
+
setPopup({event, rootValue, lang, mapComp, dynamicMapComp, currentPath, isInit}) {
|
|
461
503
|
const { targetMsg, targetMsgEn } = event
|
|
462
|
-
const msg =
|
|
463
|
-
|
|
504
|
+
const msg = lang?.indexOf('zh') > -1 ? targetMsg : targetMsgEn
|
|
505
|
+
messageInstance.warning(msg, '', {
|
|
464
506
|
showCancelButton: false,
|
|
465
507
|
});
|
|
466
|
-
// commModal({
|
|
467
|
-
// msg: storage.get('aid-language').indexOf('zh') !== -1 ? targetMsg : targetMsgEn
|
|
468
|
-
// })
|
|
469
|
-
// document && document.body && document.body.click()
|
|
470
508
|
},
|
|
471
|
-
openThePage(event,
|
|
509
|
+
openThePage({event, rootValue, mapComp, dynamicMapComp, currentPath, messageInstance, isInit}) {
|
|
472
510
|
const { targetObjVal } = event
|
|
473
511
|
if (targetObjVal) {
|
|
474
512
|
window.open(targetObjVal, '_blank')
|
|
475
513
|
}
|
|
476
514
|
},
|
|
477
|
-
setProps(event,
|
|
515
|
+
setProps({event, rootValue, mapComp, dynamicMapComp, currentPath, messageInstance, isInit}) {
|
|
478
516
|
const { targetObj: target, targetObjVal } = event
|
|
479
517
|
if (!target) return
|
|
480
518
|
|
|
481
|
-
const targetObj = `${
|
|
482
|
-
const { config } = this
|
|
519
|
+
const targetObj = `${target}`
|
|
483
520
|
let val = ''
|
|
484
521
|
try {
|
|
485
522
|
val = parseExtendAttr(
|
|
486
523
|
{
|
|
487
524
|
extendAttr: targetObjVal,
|
|
488
|
-
metaCode: `event setPorps code
|
|
525
|
+
metaCode: `event setPorps code, target path: ${currentPath}`
|
|
489
526
|
},
|
|
490
|
-
|
|
527
|
+
getPathVal(unref(rootValue), currentPath, '->')
|
|
491
528
|
)
|
|
492
529
|
} catch (err) {
|
|
493
530
|
val = ''
|
|
@@ -495,12 +532,12 @@ const allInitEvents = {
|
|
|
495
532
|
delete val.metaCode
|
|
496
533
|
if (!isPlainObject(val)) return
|
|
497
534
|
|
|
498
|
-
const configs = getCurrentComp
|
|
499
|
-
const oldPorpsList = []
|
|
535
|
+
const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
|
|
500
536
|
const porpsKeys = Object.keys(val)
|
|
501
537
|
configs.forEach((labelInfo) => {
|
|
502
538
|
let updateFlag = false
|
|
503
539
|
const oldProps = {}
|
|
540
|
+
labelInfo._eventSetPropsCbProps = oldProps
|
|
504
541
|
if (!labelInfo) return
|
|
505
542
|
porpsKeys.forEach(key => {
|
|
506
543
|
oldProps[key] = labelInfo[key]
|
|
@@ -509,8 +546,7 @@ const allInitEvents = {
|
|
|
509
546
|
updateFlag = true
|
|
510
547
|
}
|
|
511
548
|
if ((typeof val[key]) === 'string') {
|
|
512
|
-
const
|
|
513
|
-
const bindValue = config?.bindValue
|
|
549
|
+
const bindValue = getPathVal(unref(rootValue), currentPath, '->')
|
|
514
550
|
labelInfo[key] = val[key].replace(/\{([^}]+)\}/g, (originVal, matchVal) => {
|
|
515
551
|
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.REF_VAL) {
|
|
516
552
|
return bindValue
|
|
@@ -524,23 +560,19 @@ const allInitEvents = {
|
|
|
524
560
|
labelInfo[key] = val[key]
|
|
525
561
|
}
|
|
526
562
|
})
|
|
527
|
-
oldPorpsList.push(oldProps)
|
|
528
563
|
if (updateFlag) {
|
|
529
564
|
labelInfo?.wrapVm?.proxy?.$forceUpdate?.()
|
|
530
565
|
}
|
|
531
566
|
})
|
|
532
567
|
// 有的事件在不满足条件的情况下,需要进行恢复
|
|
533
568
|
return () => {
|
|
534
|
-
// 需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
535
|
-
// return setTimeout(() => {
|
|
536
569
|
configs.forEach((labelInfo, idx) => {
|
|
537
|
-
const oldProps =
|
|
570
|
+
const oldProps = labelInfo._eventSetPropsCbProps
|
|
538
571
|
if (!labelInfo) return
|
|
539
572
|
porpsKeys.forEach(key => {
|
|
540
573
|
labelInfo[key] = oldProps[key]
|
|
541
574
|
})
|
|
542
575
|
})
|
|
543
|
-
// }, 0)
|
|
544
576
|
}
|
|
545
577
|
},
|
|
546
578
|
}
|
|
@@ -548,12 +580,12 @@ const allInitEvents = {
|
|
|
548
580
|
|
|
549
581
|
export default allInitEvents
|
|
550
582
|
|
|
551
|
-
export function runEvent({events, rootValue, mapComp, currentPath, isInit, rule,}) {
|
|
583
|
+
export function runEvent({events, rootValue, mapComp, dynamicMapComp, route, lang, currentPath, isInit, rule, messageInstance}) {
|
|
552
584
|
events = events || []
|
|
553
585
|
return events.map(event => {
|
|
554
586
|
const { eventId } = event
|
|
555
587
|
const eventCode = eventsMap[eventId]
|
|
556
|
-
return allInitEvents[eventCode] && allInitEvents[eventCode]({event, rootValue, mapComp, route, lang, currentPath, isInit, rule,})
|
|
588
|
+
return allInitEvents[eventCode] && allInitEvents[eventCode]({event, rootValue, mapComp, dynamicMapComp, route, lang, currentPath, isInit, rule, messageInstance})
|
|
557
589
|
})
|
|
558
590
|
}
|
|
559
591
|
|