wui-components-v2 1.1.52 → 1.1.54
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.
|
@@ -82,11 +82,25 @@ const fetchDataById = async (id: string) => {
|
|
|
82
82
|
showValue.phone = textArr?.[1] || ''
|
|
83
83
|
showValue.address = textArr?.[2] || ''
|
|
84
84
|
}
|
|
85
|
+
// 数据获取完成后,触发 emit
|
|
86
|
+
emitIfNeeded(id)
|
|
85
87
|
} catch (error) {
|
|
86
88
|
console.error('获取数据失败:', error)
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
const emitIfNeeded = (val: string) => {
|
|
93
|
+
if (!val) return
|
|
94
|
+
let emitVal = val
|
|
95
|
+
if (typeof val === 'string' && !val.includes('@R@')) {
|
|
96
|
+
emitVal = val + '@R@' + showValue.name
|
|
97
|
+
}
|
|
98
|
+
if (emitVal !== props.modelValue) {
|
|
99
|
+
console.log('emit update:modelValue', emitVal)
|
|
100
|
+
emit('update:modelValue', emitVal)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
90
104
|
onMounted(() => {
|
|
91
105
|
if (currentValue.value) {
|
|
92
106
|
fetchDataById(currentValue.value)
|
|
@@ -112,10 +126,16 @@ watch(() => props.modelValue, (val) => {
|
|
|
112
126
|
})
|
|
113
127
|
|
|
114
128
|
watch(currentValue, (val) => {
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
if (!val) return
|
|
130
|
+
// 如果值已经包含@R@(无需异步获取数据),直接 emit
|
|
131
|
+
if (typeof val === 'string' && val.includes('@R@')) {
|
|
132
|
+
if (val !== props.modelValue) {
|
|
133
|
+
emit('update:modelValue', val)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// 否则由 fetchDataById 成功后调用 emitIfNeeded 来 emit
|
|
137
|
+
}, { immediate: true })
|
|
117
138
|
</script>
|
|
118
|
-
|
|
119
139
|
<style scoped lang="scss">
|
|
120
140
|
.custom-select-picker {
|
|
121
141
|
width: 100%;
|
|
@@ -41,11 +41,16 @@ export function useCompanyFieldFilter(
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const formatFieldsItem=(company:string,item:any)=>{
|
|
44
|
+
const transDefaultValue = item.usableRuleCriterias[0]?.transDefaultValue||''
|
|
45
|
+
const isHidden=item?.unusableMode==='hidden'
|
|
46
|
+
const values = transDefaultValue.split(',').map(v => v.trim())
|
|
44
47
|
if(!company){
|
|
45
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
...item,
|
|
50
|
+
hidden:isHidden,
|
|
51
|
+
}
|
|
46
52
|
}else{
|
|
47
|
-
|
|
48
|
-
const values = transDefaultValue.split(',').map(v => v.trim())
|
|
53
|
+
|
|
49
54
|
return {
|
|
50
55
|
...item,
|
|
51
56
|
hidden: values.some(v => v.includes(company))?false:item.hidden,
|