resolver-egretimp-plus 0.0.147 → 0.0.149
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/h5/index.js +1 -1
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +23 -11
- package/src/components/packages-web/CustomComponentSelectEmployees.vue +2 -4
- package/src/components/packages-web/ElDatePicker.vue +10 -10
- package/src/components/packages-web/ElSelect.vue +6 -2
- package/src/rules/eventsSupplement.js +95 -24
- package/src/rules/ruleUtils.js +5 -1
- package/src/rulesImp/events.js +93 -10
- package/src/rulesImp/ruleUtils.js +5 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineAsyncComponent, getCurrentInstance, inject, onBeforeMount, provide, ref } from 'vue'
|
|
1
|
+
import { computed, defineAsyncComponent, getCurrentInstance, inject, onBeforeMount, provide, ref, watch } from 'vue'
|
|
2
2
|
import { commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, hasOwn, isPlainObject } from './utils/index.js'
|
|
3
3
|
import { useVmodels } from './hooks/index.js'
|
|
4
4
|
import { getRenderComponentProps, generateFormItemPolyfill } from './utils/index.js'
|
|
@@ -149,26 +149,37 @@ export default {
|
|
|
149
149
|
|
|
150
150
|
// 获取组件中定义的props,赋值对应的属性====start====
|
|
151
151
|
const componentProps = ref({})
|
|
152
|
+
const fnComponentkeys = ref([])
|
|
153
|
+
function getFncomponentProps() {
|
|
154
|
+
const obj = {}
|
|
155
|
+
fnComponentkeys.value.forEach(key => {
|
|
156
|
+
if (hasOwn(props.config, key)) {
|
|
157
|
+
obj[key] = props.config[key]
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
return obj
|
|
161
|
+
}
|
|
152
162
|
if (typeof props.component === 'function') {
|
|
153
163
|
props.component()?.then(res => {
|
|
154
|
-
const obj = {}
|
|
155
164
|
if (res?.default?.emits) {
|
|
156
165
|
initVmodels(res?.default?.emits)
|
|
157
166
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
fnComponentkeys.value = getComponentPropsKeys(res?.default)
|
|
168
|
+
// const obj = {}
|
|
169
|
+
// const propsKeys = getComponentPropsKeys(res?.default)
|
|
170
|
+
// propsKeys.forEach(key => {
|
|
171
|
+
// if (hasOwn(props.config, key)) {
|
|
172
|
+
// obj[key] = props.config[key]
|
|
173
|
+
// }
|
|
174
|
+
// })
|
|
175
|
+
// componentProps.value = obj
|
|
165
176
|
})
|
|
166
177
|
} else {
|
|
167
178
|
if (props.component?.emits) {
|
|
168
179
|
initVmodels(props.component?.emits)
|
|
169
180
|
}
|
|
170
181
|
}
|
|
171
|
-
// 获取组件中定义的props,赋值对应的属性===
|
|
182
|
+
// 获取组件中定义的props,赋值对应的属性===end===
|
|
172
183
|
const currentComponent = computed(() => {
|
|
173
184
|
if (typeof props.component === 'function') {
|
|
174
185
|
return defineAsyncComponent(props.component)
|
|
@@ -249,6 +260,7 @@ export default {
|
|
|
249
260
|
console.error('component render failer', lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn, props.config?.metaCode, err, instance, info)
|
|
250
261
|
})
|
|
251
262
|
return () => {
|
|
263
|
+
const componentProps = getFncomponentProps()
|
|
252
264
|
const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects, lang: lang.value})
|
|
253
265
|
const compPropsOnClick = compProps?.onClick
|
|
254
266
|
delete compProps.onClick
|
|
@@ -266,7 +278,7 @@ export default {
|
|
|
266
278
|
onVnodeUnmounted={onVnodeUnmounted}
|
|
267
279
|
{...currentAttrs.value}
|
|
268
280
|
onClick={(e, params) => {onClick(e, params);compPropsOnClick?.(e)}}
|
|
269
|
-
{...componentProps
|
|
281
|
+
{...componentProps}
|
|
270
282
|
{...compProps}
|
|
271
283
|
{...vModelObjs}
|
|
272
284
|
></currentComponent.value>
|
|
@@ -78,10 +78,8 @@ const initSelEmployee = async () => {
|
|
|
78
78
|
placeholder: lang?.value?.indexOf('zh') > -1 ? props.placeholder : props.placeholderEn,
|
|
79
79
|
// disabled: props.disabled,
|
|
80
80
|
onSelectedChange: (data, arr) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
modelValue.value = data && data.join(',')
|
|
84
|
-
}
|
|
81
|
+
emit('change', data, arr, props)
|
|
82
|
+
modelValue.value = data?.join(',') || ''
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
if (props.disabled) {
|
|
@@ -7,6 +7,8 @@ import { useAttrs, computed } from 'vue'
|
|
|
7
7
|
import { commonPropsType, formatDate, isDate } from '../../utils/index.js'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
|
+
...ElDatePicker.props,
|
|
11
|
+
...commonPropsType,
|
|
10
12
|
min: {
|
|
11
13
|
type: [Date, String],
|
|
12
14
|
default: null
|
|
@@ -15,8 +17,6 @@ const props = defineProps({
|
|
|
15
17
|
type: [Date, String],
|
|
16
18
|
default: null
|
|
17
19
|
},
|
|
18
|
-
...ElDatePicker.props,
|
|
19
|
-
...commonPropsType,
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
const datePickerProps = computed(() => {
|
|
@@ -38,19 +38,19 @@ const disabledDate = (date) => {
|
|
|
38
38
|
let dateTime = formatDate(date, 'yyyy-MM-dd')
|
|
39
39
|
const newDate = new Date(dateTime)
|
|
40
40
|
if (props.min) {
|
|
41
|
-
if (isDate(props.min)) {
|
|
42
|
-
return
|
|
41
|
+
if (isDate(props.min) && props.min.getTime() > newDate.getTime()) {
|
|
42
|
+
return true
|
|
43
43
|
}
|
|
44
|
-
if (typeof props.min === 'string') {
|
|
45
|
-
return
|
|
44
|
+
if (typeof props.min === 'string' && new Date(props.min).getTime() > newDate.getTime()) {
|
|
45
|
+
return true
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (props.max) {
|
|
49
|
-
if (isDate(props.max)) {
|
|
50
|
-
return
|
|
49
|
+
if (isDate(props.max) && props.max.getTime() < newDate.getTime()) {
|
|
50
|
+
return true
|
|
51
51
|
}
|
|
52
|
-
if (typeof props.max === 'string') {
|
|
53
|
-
return
|
|
52
|
+
if (typeof props.max === 'string' && new Date(props.max).getTime() < newDate.getTime()) {
|
|
53
|
+
return true
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
|
|
3
|
-
<ElOption v-for="option in
|
|
3
|
+
<ElOption v-for="option in options"
|
|
4
4
|
:key="option.columnValue"
|
|
5
5
|
:label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
|
|
6
6
|
:value="option.columnValue"
|
|
@@ -20,6 +20,7 @@ const props = defineProps({
|
|
|
20
20
|
multiple: [String, Boolean],
|
|
21
21
|
filterable: [String, Boolean],
|
|
22
22
|
multipleLimit: [String, Number],
|
|
23
|
+
rangeOptions: Array
|
|
23
24
|
})
|
|
24
25
|
const attrs = useAttrs()
|
|
25
26
|
|
|
@@ -33,6 +34,9 @@ const isMutiple = computed(() => {
|
|
|
33
34
|
return props.multiple == '1'
|
|
34
35
|
})
|
|
35
36
|
|
|
37
|
+
const options = computed(() => {
|
|
38
|
+
return props.options?.filter?.(item => props.rangeOptions?.some(subItem => subItem.columnValue == item.columnValue))
|
|
39
|
+
})
|
|
36
40
|
|
|
37
41
|
const value = computed({
|
|
38
42
|
get() {
|
|
@@ -41,7 +45,7 @@ const value = computed({
|
|
|
41
45
|
return val ? (isStrVal.value ? val.split(',') : val) : []
|
|
42
46
|
} else {
|
|
43
47
|
if (modelValue.value !== null && modelValue.value !== undefined) {
|
|
44
|
-
if (
|
|
48
|
+
if (options.value?.some(item => item.columnValue == modelValue.value)) {
|
|
45
49
|
props.config.isMatch = true
|
|
46
50
|
return `${modelValue.value}`
|
|
47
51
|
} else {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import { ARG_FLAGS, MULTI_PAGE_META_LIST_TYPES } from '../utils/const'
|
|
29
29
|
|
|
30
30
|
// import { commModal } from '../../../common/components/cmi/components/comm-modal-tip/index'
|
|
31
|
-
import { formatDate, hasOwn, isPlainObject, parseExtendAttr } from '../utils/index';
|
|
31
|
+
import { findComponent, formatDate, hasOwn, isPlainObject, parseExtendAttr } from '../utils/index';
|
|
32
32
|
const valArrTypes = [...MULTI_PAGE_META_LIST_TYPES]
|
|
33
33
|
const valBooleanTypes = []
|
|
34
34
|
|
|
@@ -211,15 +211,8 @@ const allInitEvents = {
|
|
|
211
211
|
const { targetObj: target } = event
|
|
212
212
|
if (!target) return
|
|
213
213
|
const targetObj = `${tabpanelCode ? tabpanelCode + '->' : ''}${target}`
|
|
214
|
-
// if (target.indexOf('isSpecialPriceingApproval') > -1) {
|
|
215
|
-
// console.log('rule===:', rule)
|
|
216
|
-
// debugger
|
|
217
|
-
// }
|
|
218
214
|
const configs = getCurrentComp.call(this, targetObj)
|
|
219
215
|
// const oldDisplayTypes = []
|
|
220
|
-
// if (target.indexOf('amountBilled') > -1) {
|
|
221
|
-
// debugger
|
|
222
|
-
// }
|
|
223
216
|
configs.forEach((labelInfo) => {
|
|
224
217
|
// const oldDisplayType = labelInfo && labelInfo.displayType
|
|
225
218
|
// oldDisplayTypes.push(oldDisplayType)
|
|
@@ -232,10 +225,6 @@ const allInitEvents = {
|
|
|
232
225
|
return () => {
|
|
233
226
|
// 隐藏的效果需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
234
227
|
return setTimeout(() => {
|
|
235
|
-
// if (target.indexOf('isSpecialPriceingApproval') > -1) {
|
|
236
|
-
// console.log('rule===:', rule)
|
|
237
|
-
// debugger
|
|
238
|
-
// }
|
|
239
228
|
configs.forEach((labelInfo, idx) => {
|
|
240
229
|
// const oldDisplayType = oldDisplayTypes[idx]
|
|
241
230
|
labelInfo && /^\d+$/.test(labelInfo.displayType) && (labelInfo.displayType = '0')
|
|
@@ -326,16 +315,100 @@ const allInitEvents = {
|
|
|
326
315
|
const { targetObj: target, targetObjVal = '' } = event
|
|
327
316
|
if (!target) return
|
|
328
317
|
const targetObj = `${tabpanelCode ? tabpanelCode + '->' : ''}${target}`
|
|
329
|
-
|
|
318
|
+
let range = []
|
|
319
|
+
if (targetObjVal?.indexOf('~') > -1) {
|
|
320
|
+
range = targetObjVal.split('~')
|
|
321
|
+
} else {
|
|
322
|
+
range = targetObjVal.split(',')
|
|
323
|
+
}
|
|
330
324
|
if (range && range.length) {
|
|
331
|
-
const
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
325
|
+
const oldPorpsList = []
|
|
326
|
+
const configs = getCurrentComp.call(this, targetObj)
|
|
327
|
+
configs.forEach(config => {
|
|
328
|
+
let updateFlag = false
|
|
329
|
+
const oldProps = {}
|
|
330
|
+
oldPorpsList.push(oldProps)
|
|
331
|
+
if (!config) return
|
|
332
|
+
const { config: currentConfig } = this
|
|
333
|
+
let val = ''
|
|
334
|
+
if (findComponent(['ElDatePicker'], config?.renderby || config?.metaType) !== -1) {
|
|
335
|
+
const min = range[0]
|
|
336
|
+
const max = range[1]
|
|
337
|
+
try {
|
|
338
|
+
val = parseExtendAttr(
|
|
339
|
+
{
|
|
340
|
+
extendAttr: JSON.stringify({min, max}),
|
|
341
|
+
metaCode: `event limitDataRange code:${config.metaCode}`
|
|
342
|
+
},
|
|
343
|
+
currentConfig?.bindValue
|
|
344
|
+
)
|
|
345
|
+
} catch (err) {
|
|
346
|
+
val = ''
|
|
347
|
+
}
|
|
348
|
+
} else if (findComponent(['ElSelect'], config?.renderby || config?.metaType) !== -1) {
|
|
349
|
+
try {
|
|
350
|
+
console.log('event==:', event)
|
|
351
|
+
val = parseExtendAttr(
|
|
352
|
+
{
|
|
353
|
+
extendAttr: JSON.stringify({rangeOptions: range}),
|
|
354
|
+
metaCode: `event limitDataRange code:${config.metaCode}`
|
|
355
|
+
},
|
|
356
|
+
currentConfig?.bindValue
|
|
357
|
+
)
|
|
358
|
+
} catch (err) {
|
|
359
|
+
val = ''
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
const currentVal = getConfigValue.call(this, targetObj, true)
|
|
363
|
+
if (min && lessThan(currentVal, min)) {
|
|
364
|
+
setFormVal.call(this, config, min)
|
|
365
|
+
}
|
|
366
|
+
if (max && greaterThan(currentVal, max)) {
|
|
367
|
+
setFormVal.call(this, config, max)
|
|
368
|
+
}
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
delete val.metaCode
|
|
372
|
+
if (!isPlainObject(val)) return
|
|
373
|
+
const porpsKeys = Object.keys(val)
|
|
374
|
+
porpsKeys.forEach(key => {
|
|
375
|
+
oldProps[key] = config[key]
|
|
376
|
+
if (!hasOwn(config, key)) {
|
|
377
|
+
// 如果有一个属性没有,就需要更新下组件,防止渲染不及时
|
|
378
|
+
updateFlag = true
|
|
379
|
+
}
|
|
380
|
+
if ((typeof val[key]) === 'string') {
|
|
381
|
+
const { config: currentConfig } = this
|
|
382
|
+
const bindValue = currentConfig?.bindValue
|
|
383
|
+
config[key] = val[key].replace(/\{([^}]+)\}/g, (originVal, matchVal) => {
|
|
384
|
+
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.REF_VAL) {
|
|
385
|
+
return bindValue
|
|
386
|
+
}
|
|
387
|
+
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.CURRENT_DATE) {
|
|
388
|
+
return formatDate(new Date(), 'yyyy-MM-dd')
|
|
389
|
+
}
|
|
390
|
+
return originVal
|
|
391
|
+
})
|
|
392
|
+
} else {
|
|
393
|
+
config[key] = val[key]
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
if (updateFlag) {
|
|
397
|
+
config?.wrapVm?.ctx?.$forceUpdate?.()
|
|
398
|
+
}
|
|
399
|
+
})
|
|
400
|
+
return () => {
|
|
401
|
+
// 需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
402
|
+
return setTimeout(() => {
|
|
403
|
+
configs.forEach((labelInfo, idx) => {
|
|
404
|
+
const oldProps = oldPorpsList[idx]
|
|
405
|
+
if (!labelInfo) return
|
|
406
|
+
const porpsKeys = Object.keys(oldProps)
|
|
407
|
+
porpsKeys.forEach(key => {
|
|
408
|
+
labelInfo[key] = oldProps[key]
|
|
409
|
+
})
|
|
410
|
+
})
|
|
411
|
+
}, 0)
|
|
339
412
|
}
|
|
340
413
|
}
|
|
341
414
|
},
|
|
@@ -374,14 +447,12 @@ const allInitEvents = {
|
|
|
374
447
|
} catch (err) {
|
|
375
448
|
val = ''
|
|
376
449
|
}
|
|
450
|
+
delete val.metaCode
|
|
377
451
|
if (!isPlainObject(val)) return
|
|
378
452
|
|
|
379
453
|
const configs = getCurrentComp.call(this, targetObj)
|
|
380
454
|
const oldPorpsList = []
|
|
381
455
|
const porpsKeys = Object.keys(val)
|
|
382
|
-
// if (target.indexOf('amountBilled') > -1) {
|
|
383
|
-
// debugger
|
|
384
|
-
// }
|
|
385
456
|
configs.forEach((labelInfo) => {
|
|
386
457
|
let updateFlag = false
|
|
387
458
|
const oldProps = {}
|
package/src/rules/ruleUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import { hasOwn } from "../utils"
|
|
2
|
+
import { hasOwn, isPlainObject } from "../utils"
|
|
3
3
|
import { MULTI_PAGE_META_LIST_TYPES, findComponent } from '../utils/index'
|
|
4
4
|
|
|
5
5
|
// 这边是一些组件在执行规则的时候,如果还没有加载出来,规则会走不动,这边就是存储没走通的规则,等组件加载完之后,再去执行
|
|
@@ -36,6 +36,10 @@ export function setFormVal(pathStr, val) {
|
|
|
36
36
|
if (!pathStr) {
|
|
37
37
|
return
|
|
38
38
|
}
|
|
39
|
+
if (isPlainObject(pathStr)) {
|
|
40
|
+
hasOwn(pathStr, 'refValue') && (pathStr.refValue = val)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
39
43
|
const { config } = this
|
|
40
44
|
const configs = getRelateConfigs.call(this, pathStr, config)
|
|
41
45
|
configs.forEach(cg => {
|
package/src/rulesImp/events.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from './ruleUtils'
|
|
28
28
|
import { ARG_FLAGS, MULTI_PAGE_META_LIST_TYPES } from '../utils/const'
|
|
29
29
|
|
|
30
|
-
import { formatDate, hasOwn, isPlainObject, parseExtendAttr } from '../utils/index';
|
|
30
|
+
import { findComponent, formatDate, hasOwn, isPlainObject, parseExtendAttr } from '../utils/index';
|
|
31
31
|
const valArrTypes = [...MULTI_PAGE_META_LIST_TYPES]
|
|
32
32
|
const valBooleanTypes = []
|
|
33
33
|
|
|
@@ -382,16 +382,99 @@ const allInitEvents = {
|
|
|
382
382
|
const { targetObj: target, targetObjVal = '' } = event
|
|
383
383
|
if (!target) return
|
|
384
384
|
const targetObj = `${target}`
|
|
385
|
-
|
|
385
|
+
let range = []
|
|
386
|
+
if (targetObjVal?.indexOf('~') > -1) {
|
|
387
|
+
range = targetObjVal.split('~')
|
|
388
|
+
} else {
|
|
389
|
+
range = targetObjVal.split(',')
|
|
390
|
+
}
|
|
386
391
|
if (range && range.length) {
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
const oldPorpsList = []
|
|
393
|
+
const configs = getCurrentComp.call(this, targetObj)
|
|
394
|
+
configs.forEach(config => {
|
|
395
|
+
let updateFlag = false
|
|
396
|
+
const oldProps = {}
|
|
397
|
+
oldPorpsList.push(oldProps)
|
|
398
|
+
if (!config) return
|
|
399
|
+
const { config: currentConfig } = this
|
|
400
|
+
let val = ''
|
|
401
|
+
if (findComponent(['ElDatePicker'], config?.renderby || config?.metaType) !== -1) {
|
|
402
|
+
const min = range[0]
|
|
403
|
+
const max = range[1]
|
|
404
|
+
try {
|
|
405
|
+
val = parseExtendAttr(
|
|
406
|
+
{
|
|
407
|
+
extendAttr: JSON.JSON({min, max}),
|
|
408
|
+
metaCode: `event limitDataRange code:${config.metaCode}`
|
|
409
|
+
},
|
|
410
|
+
currentConfig?.bindValue
|
|
411
|
+
)
|
|
412
|
+
} catch (err) {
|
|
413
|
+
val = ''
|
|
414
|
+
}
|
|
415
|
+
} else if (findComponent(['ElSelect'], config?.renderby || config?.metaType) !== -1) {
|
|
416
|
+
try {
|
|
417
|
+
val = parseExtendAttr(
|
|
418
|
+
{
|
|
419
|
+
extendAttr: JSON.JSON({rangeOptions: range}),
|
|
420
|
+
metaCode: `event limitDataRange code:${config.metaCode}`
|
|
421
|
+
},
|
|
422
|
+
currentConfig?.bindValue
|
|
423
|
+
)
|
|
424
|
+
} catch (err) {
|
|
425
|
+
val = ''
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
428
|
+
const currentVal = getConfigValue.call(this, targetObj, true)
|
|
429
|
+
if (min && lessThan(currentVal, min)) {
|
|
430
|
+
setFormVal.call(this, config, min)
|
|
431
|
+
}
|
|
432
|
+
if (max && greaterThan(currentVal, max)) {
|
|
433
|
+
setFormVal.call(this, config, max)
|
|
434
|
+
}
|
|
435
|
+
return
|
|
436
|
+
}
|
|
437
|
+
delete val.metaCode
|
|
438
|
+
if (!isPlainObject(val)) return
|
|
439
|
+
const porpsKeys = Object.keys(val)
|
|
440
|
+
porpsKeys.forEach(key => {
|
|
441
|
+
oldProps[key] = config[key]
|
|
442
|
+
if (!hasOwn(config, key)) {
|
|
443
|
+
// 如果有一个属性没有,就需要更新下组件,防止渲染不及时
|
|
444
|
+
updateFlag = true
|
|
445
|
+
}
|
|
446
|
+
if ((typeof val[key]) === 'string') {
|
|
447
|
+
const { config: currentConfig } = this
|
|
448
|
+
const bindValue = currentConfig?.bindValue
|
|
449
|
+
config[key] = val[key].replace(/\{([^}]+)\}/g, (originVal, matchVal) => {
|
|
450
|
+
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.REF_VAL) {
|
|
451
|
+
return bindValue
|
|
452
|
+
}
|
|
453
|
+
if (matchVal.trimEnd().trimStart() === ARG_FLAGS.CURRENT_DATE) {
|
|
454
|
+
return formatDate(new Date(), 'yyyy-MM-dd')
|
|
455
|
+
}
|
|
456
|
+
return originVal
|
|
457
|
+
})
|
|
458
|
+
} else {
|
|
459
|
+
config[key] = val[key]
|
|
460
|
+
}
|
|
461
|
+
})
|
|
462
|
+
if (updateFlag) {
|
|
463
|
+
config?.wrapVm?.ctx?.$forceUpdate?.()
|
|
464
|
+
}
|
|
465
|
+
})
|
|
466
|
+
return () => {
|
|
467
|
+
// 需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
468
|
+
return setTimeout(() => {
|
|
469
|
+
configs.forEach((labelInfo, idx) => {
|
|
470
|
+
const oldProps = oldPorpsList[idx]
|
|
471
|
+
if (!labelInfo) return
|
|
472
|
+
const porpsKeys = Object.keys(oldProps)
|
|
473
|
+
porpsKeys.forEach(key => {
|
|
474
|
+
labelInfo[key] = oldProps[key]
|
|
475
|
+
})
|
|
476
|
+
})
|
|
477
|
+
}, 0)
|
|
395
478
|
}
|
|
396
479
|
}
|
|
397
480
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasOwn } from "../utils"
|
|
1
|
+
import { hasOwn, isPlainObject } from "../utils"
|
|
2
2
|
|
|
3
3
|
export function getRelateConfigKeys(keys = [], path = '', relatePath = '') {
|
|
4
4
|
const pathArr = path ? path.split('->') : []
|
|
@@ -77,6 +77,10 @@ export function setFormVal(pathStr, val) {
|
|
|
77
77
|
if (!pathStr) {
|
|
78
78
|
return
|
|
79
79
|
}
|
|
80
|
+
if (isPlainObject(pathStr)) {
|
|
81
|
+
hasOwn(pathStr, 'refValue') && (pathStr.refValue = val)
|
|
82
|
+
return
|
|
83
|
+
}
|
|
80
84
|
const configs = getCurrentComp.call(this, pathStr)
|
|
81
85
|
configs.forEach(cg => {
|
|
82
86
|
hasOwn(cg, 'refValue') && (cg.refValue = val)
|