|
|
|
@ -24,6 +24,8 @@ export function useViewColumns(
|
|
|
|
|
|
|
|
|
|
const { $api } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
|
|
|
|
|
|
|
const loadViewColumns = async () => { |
|
|
|
|
if (!meta || !view) return |
|
|
|
|
|
|
|
|
@ -88,11 +90,13 @@ export function useViewColumns(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const saveOrUpdate = async (field: any, index: number) => { |
|
|
|
|
if (isUIAllowed('fieldsSync')) { |
|
|
|
|
if (field.id && view?.value?.id) { |
|
|
|
|
await $api.dbViewColumn.update(view.value.id, field.id, field) |
|
|
|
|
} else if (view?.value?.id) { |
|
|
|
|
if (fields.value) fields.value[index] = (await $api.dbViewColumn.create(view.value.id, field)) as any |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
reloadData?.() |
|
|
|
|
} |
|
|
|
|