diff --git a/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue b/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue index 161994a609..d23b224239 100644 --- a/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue @@ -92,8 +92,10 @@ const refTables = computed(() => { }) const refViews = computed(() => { - if (!vModel.value.childId) return [] - const views = viewsByTable.value.get(vModel.value.childId) + const childId = vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId + + if (!childId) return [] + const views = viewsByTable.value.get(childId) return (views || []).filter((v) => v.type !== ViewTypes.FORM) }) @@ -105,7 +107,7 @@ const isLinks = computed(() => vModel.value.uidt === UITypes.Links && vModel.val const { metas, getMeta } = useMetas() watch( - () => vModel.value.childId, + () => (vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId), async (tableId) => { if (tableId) { getMeta(tableId).catch(() => { @@ -146,7 +148,10 @@ const onLimitRecToViewChange = (value: boolean) => { provide( MetaInj, - computed(() => metas.value[vModel.value.childId] || {}), + computed(() => { + const childId = vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId + return metas.value[childId] || {} + }), ) onMounted(() => { @@ -223,6 +228,23 @@ const handleShowAdvanceOptions = () => { vModel.value.is_custom_link = false } } + +const onCustomSwitchLabelClick = () => { + vModel.value.is_custom_link = !vModel.value.is_custom_link + onCustomSwitchToggle() +} + +const onViewLabelClick = () => { + if (!vModel.value.childId && !(vModel.value.is_custom_link && vModel.value.custom?.ref_model_id)) return + + limitRecToView.value = !limitRecToView.value + onLimitRecToViewChange() +} +const onFilterLabelClick = () => { + if (!vModel.value.childId && !(vModel.value.is_custom_link && vModel.value.custom?.ref_model_id)) return + + limitRecToCond.value = !limitRecToCond.value +}