wui-components-v2 1.1.51 → 1.1.52
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.
|
@@ -40,12 +40,25 @@ export function useCompanyFieldFilter(
|
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const formatFieldsItem=(company:string,item:any)=>{
|
|
44
|
+
if(!company){
|
|
45
|
+
return item
|
|
46
|
+
}else{
|
|
47
|
+
const transDefaultValue = item.usableRuleCriterias[0]?.transDefaultValue||''
|
|
48
|
+
const values = transDefaultValue.split(',').map(v => v.trim())
|
|
49
|
+
return {
|
|
50
|
+
...item,
|
|
51
|
+
hidden: values.some(v => v.includes(company))?false:item.hidden,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
}
|
|
43
56
|
const filteredFields = computed(() => {
|
|
44
57
|
const company = selectedCompany.value
|
|
45
58
|
const allFields = fieldGroup()?.fields
|
|
46
59
|
if (!allFields)
|
|
47
60
|
return []
|
|
48
|
-
|
|
61
|
+
const formattedFields = allFields.filter((item: any) => {
|
|
49
62
|
// 如果没有选中公司,所有字段都显示
|
|
50
63
|
if (!company) {
|
|
51
64
|
return true
|
|
@@ -63,6 +76,7 @@ export function useCompanyFieldFilter(
|
|
|
63
76
|
}
|
|
64
77
|
return true
|
|
65
78
|
})
|
|
79
|
+
return formattedFields.map((item: any) => formatFieldsItem(company, item))
|
|
66
80
|
})
|
|
67
81
|
watch(filteredFields, (val) => {
|
|
68
82
|
// console.log('filteredFields变化了', val, 'selectedCompany:', selectedCompany.value)
|