|
|
@ -22,7 +22,7 @@ const baseStore = useBase() |
|
|
|
|
|
|
|
|
|
|
|
const { tables } = storeToRefs(baseStore) |
|
|
|
const { tables } = storeToRefs(baseStore) |
|
|
|
|
|
|
|
|
|
|
|
const { metas } = useMetas() |
|
|
|
const { metas, getMeta } = useMetas() |
|
|
|
|
|
|
|
|
|
|
|
setAdditionalValidations({ |
|
|
|
setAdditionalValidations({ |
|
|
|
fk_relation_column_id: [{ required: true, message: t('general.required') }], |
|
|
|
fk_relation_column_id: [{ required: true, message: t('general.required') }], |
|
|
@ -48,12 +48,15 @@ const refTables = computed(() => { |
|
|
|
return _refTables as Required<TableType & { column: ColumnType; col: Required<LinkToAnotherRecordType> }>[] |
|
|
|
return _refTables as Required<TableType & { column: ColumnType; col: Required<LinkToAnotherRecordType> }>[] |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selectedTable = computed(() => { |
|
|
|
|
|
|
|
return refTables.value.find((t) => t.column.id === vModel.value.fk_relation_column_id) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const columns = computed<ColumnType[]>(() => { |
|
|
|
const columns = computed<ColumnType[]>(() => { |
|
|
|
const selectedTable = refTables.value.find((t) => t.column.id === vModel.value.fk_relation_column_id) |
|
|
|
if (!selectedTable.value?.id) { |
|
|
|
if (!selectedTable?.id) { |
|
|
|
|
|
|
|
return [] |
|
|
|
return [] |
|
|
|
} |
|
|
|
} |
|
|
|
return metas.value[selectedTable.id].columns.filter( |
|
|
|
return metas.value[selectedTable.id]?.columns.filter( |
|
|
|
(c: ColumnType) => |
|
|
|
(c: ColumnType) => |
|
|
|
vModel.value.fk_lookup_column_id === c.id || (!isSystemColumn(c) && c.id !== vModel.value.id && c.uidt !== UITypes.Links), |
|
|
|
vModel.value.fk_lookup_column_id === c.id || (!isSystemColumn(c) && c.id !== vModel.value.id && c.uidt !== UITypes.Links), |
|
|
|
) |
|
|
|
) |
|
|
@ -66,7 +69,10 @@ onMounted(() => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const onRelationColChange = () => { |
|
|
|
const onRelationColChange = async () => { |
|
|
|
|
|
|
|
if (selectedTable.value) { |
|
|
|
|
|
|
|
await getMeta(selectedTable.value.id) |
|
|
|
|
|
|
|
} |
|
|
|
vModel.value.fk_lookup_column_id = columns.value?.[0]?.id |
|
|
|
vModel.value.fk_lookup_column_id = columns.value?.[0]?.id |
|
|
|
onDataTypeChange() |
|
|
|
onDataTypeChange() |
|
|
|
} |
|
|
|
} |
|
|
|