|
|
@ -29,6 +29,8 @@ const { isSharedBase } = storeToRefs(useBase()) |
|
|
|
|
|
|
|
|
|
|
|
const filterQueryRef = ref() |
|
|
|
const filterQueryRef = ref() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
const { $e } = useNuxtApp() |
|
|
|
const { $e } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
@ -53,6 +55,8 @@ const { addLTARRef, isNew, removeLTARRef, state: rowState } = useSmartsheetRowSt |
|
|
|
|
|
|
|
|
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isExpandedFormCloseAfterSave = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
isChildrenExcludedLoading.value = true |
|
|
|
isChildrenExcludedLoading.value = true |
|
|
|
|
|
|
|
|
|
|
|
const isForm = inject(IsFormInj, ref(false)) |
|
|
|
const isForm = inject(IsFormInj, ref(false)) |
|
|
@ -112,7 +116,8 @@ const newRowState = computed(() => { |
|
|
|
if (isNew.value) return {} |
|
|
|
if (isNew.value) return {} |
|
|
|
const colOpt = (injectedColumn?.value as ColumnType)?.colOptions as LinkToAnotherRecordType |
|
|
|
const colOpt = (injectedColumn?.value as ColumnType)?.colOptions as LinkToAnotherRecordType |
|
|
|
const colInRelatedTable: ColumnType | undefined = relatedTableMeta?.value?.columns?.find((col) => { |
|
|
|
const colInRelatedTable: ColumnType | undefined = relatedTableMeta?.value?.columns?.find((col) => { |
|
|
|
if (col.uidt !== UITypes.LinkToAnotherRecord) return false |
|
|
|
// Links as for the case of 'mm' we need the 'Links' column |
|
|
|
|
|
|
|
if (!isLinksOrLTAR(col)) return false |
|
|
|
const colOpt1 = col?.colOptions as LinkToAnotherRecordType |
|
|
|
const colOpt1 = col?.colOptions as LinkToAnotherRecordType |
|
|
|
if (colOpt1?.fk_related_model_id !== meta.value.id) return false |
|
|
|
if (colOpt1?.fk_related_model_id !== meta.value.id) return false |
|
|
|
|
|
|
|
|
|
|
@ -157,6 +162,10 @@ const relation = computed(() => { |
|
|
|
|
|
|
|
|
|
|
|
watch(expandedFormDlg, () => { |
|
|
|
watch(expandedFormDlg, () => { |
|
|
|
if (!expandedFormDlg.value) { |
|
|
|
if (!expandedFormDlg.value) { |
|
|
|
|
|
|
|
isExpandedFormCloseAfterSave.value = false |
|
|
|
|
|
|
|
if (!isForm.value) { |
|
|
|
|
|
|
|
loadChildrenList() |
|
|
|
|
|
|
|
} |
|
|
|
loadChildrenExcludedList(rowState.value) |
|
|
|
loadChildrenExcludedList(rowState.value) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -173,6 +182,42 @@ const onClick = (refRow: any, id: string) => { |
|
|
|
linkRow(refRow, Number.parseInt(id)) |
|
|
|
linkRow(refRow, Number.parseInt(id)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const addNewRecord = () => { |
|
|
|
|
|
|
|
expandedFormRow.value = {} |
|
|
|
|
|
|
|
expandedFormDlg.value = true |
|
|
|
|
|
|
|
isExpandedFormCloseAfterSave.value = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onCreatedRecord = (record: any) => { |
|
|
|
|
|
|
|
const msgVNode = h( |
|
|
|
|
|
|
|
'div', |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
class: 'ml-1 inline-flex flex-col gap-1 items-start', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
h( |
|
|
|
|
|
|
|
'span', |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
class: 'font-semibold', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
t('activity.recordCreatedLinked'), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
h( |
|
|
|
|
|
|
|
'span', |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
class: 'text-gray-500', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
t('activity.gotSavedLinkedSuccessfully', { |
|
|
|
|
|
|
|
tableName: relatedTableMeta.value?.title, |
|
|
|
|
|
|
|
recordTitle: record[relatedTableDisplayValueProp.value], |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.success(msgVNode) |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -191,14 +236,14 @@ const onClick = (refRow: any, id: string) => { |
|
|
|
:table-title="meta?.title" |
|
|
|
:table-title="meta?.title" |
|
|
|
:related-table-title="relatedTableMeta?.title" |
|
|
|
:related-table-title="relatedTableMeta?.title" |
|
|
|
:display-value="row.row[displayValueProp]" |
|
|
|
:display-value="row.row[displayValueProp]" |
|
|
|
|
|
|
|
:header="$t('activity.addNewLink')" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div class="!xs:hidden my-3 bg-gray-50 border-gray-50 border-b-2"></div> |
|
|
|
|
|
|
|
<div class="flex mt-2 mb-2 items-center gap-2"> |
|
|
|
<div class="flex mt-2 mb-2 items-center gap-2"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="flex items-center border-1 p-1 rounded-md w-full border-gray-200" |
|
|
|
class="flex items-center border-1 p-1 rounded-md w-full border-gray-200" |
|
|
|
:class="{ '!border-primary': childrenExcludedListPagination.query.length !== 0 || isFocused }" |
|
|
|
:class="{ '!border-primary': childrenExcludedListPagination.query.length !== 0 || isFocused }" |
|
|
|
> |
|
|
|
> |
|
|
|
<MdiMagnify class="w-5 h-5 ml-2" /> |
|
|
|
<MdiMagnify class="w-5 h-5 ml-2 text-gray-500" /> |
|
|
|
<a-input |
|
|
|
<a-input |
|
|
|
ref="filterQueryRef" |
|
|
|
ref="filterQueryRef" |
|
|
|
v-model:value="childrenExcludedListPagination.query" |
|
|
|
v-model:value="childrenExcludedListPagination.query" |
|
|
@ -223,12 +268,7 @@ const onClick = (refRow: any, id: string) => { |
|
|
|
type="secondary" |
|
|
|
type="secondary" |
|
|
|
:size="isMobileMode ? 'medium' : 'small'" |
|
|
|
:size="isMobileMode ? 'medium' : 'small'" |
|
|
|
class="!text-brand-500" |
|
|
|
class="!text-brand-500" |
|
|
|
@click=" |
|
|
|
@click="addNewRecord" |
|
|
|
() => { |
|
|
|
|
|
|
|
expandedFormRow = {} |
|
|
|
|
|
|
|
expandedFormDlg = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex items-center gap-1 px-4"><MdiPlus v-if="!isMobileMode" /> {{ $t('activity.newRecord') }}</div> |
|
|
|
<div class="flex items-center gap-1 px-4"><MdiPlus v-if="!isMobileMode" /> {{ $t('activity.newRecord') }}</div> |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
@ -344,6 +384,15 @@ const onClick = (refRow: any, id: string) => { |
|
|
|
:row-id="extractPkFromRow(expandedFormRow, relatedTableMeta.columns as ColumnType[])" |
|
|
|
:row-id="extractPkFromRow(expandedFormRow, relatedTableMeta.columns as ColumnType[])" |
|
|
|
:state="newRowState" |
|
|
|
:state="newRowState" |
|
|
|
use-meta-fields |
|
|
|
use-meta-fields |
|
|
|
|
|
|
|
:close-after-save="isExpandedFormCloseAfterSave" |
|
|
|
|
|
|
|
:new-record-header=" |
|
|
|
|
|
|
|
isExpandedFormCloseAfterSave |
|
|
|
|
|
|
|
? $t('activity.tableNameCreateNewRecord', { |
|
|
|
|
|
|
|
tableName: relatedTableMeta?.title, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
: undefined |
|
|
|
|
|
|
|
" |
|
|
|
|
|
|
|
@created-record="onCreatedRecord" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Suspense> |
|
|
|
</Suspense> |
|
|
|
</NcModal> |
|
|
|
</NcModal> |
|
|
|