fix: view form linkages

This commit is contained in:
chenos 2021-03-28 21:01:22 +08:00
parent 25c1aa8825
commit 0900296ea3
3 changed files with 22 additions and 7 deletions

View File

@ -36,6 +36,19 @@ export default {
labelField: 'title', labelField: 'title',
valueField: 'id', valueField: 'id',
}, },
"x-linkages": [
{
"type": "value:schema",
"target": "field",
"schema": {
"x-component-props": {
"filter": {
"collection_name": "{{ $self.value && $self.value.collection_name }}"
}
}
}
}
]
}, },
}, },
{ {

View File

@ -50,11 +50,13 @@ export default {
"target": "targetField", "target": "targetField",
"condition": "{{ $self.value === 'association' }}" "condition": "{{ $self.value === 'association' }}"
}, },
// { ...['form', 'descriptions', 'table', 'kanban', 'calendar'].map(type => {
// "type": "value:visible", return {
// "target": "type", "type": "value:visible",
// "condition": "{{ $self.value === 'collection' }}" "target": `x-${type}-props.*`,
// }, "condition": `{{ $form.values.type === '${type}' && $self.value === 'collection' }}`
}
}),
], ],
}, },
{ {

View File

@ -38,7 +38,7 @@ export function getViewTypeLinkages() {
xlinkages.push({ xlinkages.push({
"type": "value:visible", "type": "value:visible",
"target": `x-${key}-props.*`, "target": `x-${key}-props.*`,
"condition": `{{ $self.value === '${key}' }}`, "condition": `{{ $self.value === '${key}' && $form.values.dataSourceType === 'collection' }}`,
}); });
if (linkages.type) { if (linkages.type) {
xlinkages.push(...linkages.type); xlinkages.push(...linkages.type);
@ -55,7 +55,7 @@ export function getTypeFieldOptions() {
title: '视图类型', title: '视图类型',
required: true, required: true,
dataSource: getOptions(), dataSource: getOptions(),
createOnly: true, createOnly: false,
component: { component: {
type: 'select', type: 'select',
}, },