|
|
@ -94,14 +94,14 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
await getMeta(colOptions.fk_related_model_id as string) |
|
|
|
await getMeta(colOptions.fk_related_model_id as string) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const relatedTablePrimaryValueProp = computed(() => { |
|
|
|
const relatedTableDisplayValueProp = computed(() => { |
|
|
|
return (relatedTableMeta.value?.columns?.find((c) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title || '' |
|
|
|
return (relatedTableMeta.value?.columns?.find((c) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title || '' |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const relatedTablePrimaryKeyProps = computed(() => { |
|
|
|
const relatedTablePrimaryKeyProps = computed(() => { |
|
|
|
return relatedTableMeta.value?.columns?.filter((c) => c.pk)?.map((c) => c.title) ?? [] |
|
|
|
return relatedTableMeta.value?.columns?.filter((c) => c.pk)?.map((c) => c.title) ?? [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
const primaryValueProp = computed(() => { |
|
|
|
const displayValueProp = computed(() => { |
|
|
|
return (meta.value?.columns?.find((c: Required<ColumnType>) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title |
|
|
|
return (meta.value?.columns?.find((c: Required<ColumnType>) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -125,8 +125,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), |
|
|
|
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), |
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
`(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
fields: [relatedTablePrimaryValueProp.value, ...relatedTablePrimaryKeyProps.value], |
|
|
|
fields: [relatedTableDisplayValueProp.value, ...relatedTablePrimaryKeyProps.value], |
|
|
|
} as RequestParams, |
|
|
|
} as RequestParams, |
|
|
|
}, |
|
|
|
}, |
|
|
|
) |
|
|
|
) |
|
|
@ -142,8 +142,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), |
|
|
|
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), |
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
`(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
fields: [relatedTablePrimaryValueProp.value, ...relatedTablePrimaryKeyProps.value], |
|
|
|
fields: [relatedTableDisplayValueProp.value, ...relatedTablePrimaryKeyProps.value], |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -160,7 +160,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
// todo: where clause is missing from type
|
|
|
|
// todo: where clause is missing from type
|
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
`(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -183,7 +183,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
limit: String(childrenListPagination.size), |
|
|
|
limit: String(childrenListPagination.size), |
|
|
|
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)), |
|
|
|
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)), |
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
childrenListPagination.query && `(${relatedTableDisplayValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -198,7 +198,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
limit: String(childrenListPagination.size), |
|
|
|
limit: String(childrenListPagination.size), |
|
|
|
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)), |
|
|
|
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)), |
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
childrenListPagination.query && `(${relatedTableDisplayValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -320,13 +320,13 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
return { |
|
|
|
return { |
|
|
|
relatedTableMeta, |
|
|
|
relatedTableMeta, |
|
|
|
loadRelatedTableMeta, |
|
|
|
loadRelatedTableMeta, |
|
|
|
relatedTablePrimaryValueProp, |
|
|
|
relatedTableDisplayValueProp, |
|
|
|
childrenExcludedList, |
|
|
|
childrenExcludedList, |
|
|
|
childrenList, |
|
|
|
childrenList, |
|
|
|
rowId, |
|
|
|
rowId, |
|
|
|
childrenExcludedListPagination, |
|
|
|
childrenExcludedListPagination, |
|
|
|
childrenListPagination, |
|
|
|
childrenListPagination, |
|
|
|
primaryValueProp, |
|
|
|
displayValueProp, |
|
|
|
meta, |
|
|
|
meta, |
|
|
|
unlink, |
|
|
|
unlink, |
|
|
|
link, |
|
|
|
link, |
|
|
|