wui-components-v2 1.2.11 → 1.2.12
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.
|
@@ -62,7 +62,7 @@ const giveDefaultValue = (value: any) => {
|
|
|
62
62
|
defaultValue[key] = typeof val === 'string' && val.includes('@R@') ? val.split('@R@')[0] : val
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return defaultValue[value]
|
|
65
|
+
return defaultValue[value] ?? ''
|
|
66
66
|
}
|
|
67
67
|
giveDefaultValue({})
|
|
68
68
|
// 初始化表单数据
|
|
@@ -79,10 +79,18 @@ function initFormData() {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'relselect') {
|
|
82
|
-
|
|
83
|
-
(props.entity && props.entity[item.sourceId]
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
const rawRel =
|
|
83
|
+
(props.entity && props.entity[item.sourceId]) || item.transDefaultValue || item.defaultValue || ''
|
|
84
|
+
// 解析 $$user. 占位符:取当前用户对应扩展字段的值(实体字段为 code@R@name,需保留完整值供回显)
|
|
85
|
+
let resolvedRel: any = rawRel
|
|
86
|
+
if (typeof rawRel === 'string' && rawRel.includes('$$user.')) {
|
|
87
|
+
const ukey = rawRel.split('$$user.')[1]
|
|
88
|
+
const { extInfo = {} } = uni.getStorageSync('userInfo') || {}
|
|
89
|
+
const fmap = extInfo.fieldMap || {}
|
|
90
|
+
const uval = fmap[ukey]
|
|
91
|
+
resolvedRel = uval !== undefined && uval !== null ? String(uval) : ''
|
|
92
|
+
}
|
|
93
|
+
return (models[item.sourceId] = resolvedRel ? String(resolvedRel).split('@,@') : [])
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
// 文件
|
|
@@ -136,7 +144,7 @@ function initFormData() {
|
|
|
136
144
|
return (models[item.sourceId] = isYes ? '是' : '否')
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
return (models[item.sourceId] = (props.entity && props.entity[item.sourceId]) || item.transDefaultValue || '')
|
|
147
|
+
return (models[item.sourceId] = (props.entity && props.entity[item.sourceId]) || item.transDefaultValue || item.defaultValue || '')
|
|
140
148
|
})
|
|
141
149
|
|
|
142
150
|
// 遍历 models,处理 $$user. 前缀
|