|
|
@ -33,7 +33,7 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState( |
|
|
|
|
|
|
|
|
|
|
|
const formattedData = ref<Row[]>([]) |
|
|
|
const formattedData = ref<Row[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
const { api } = useApi() |
|
|
|
// const { api } = useApi()
|
|
|
|
|
|
|
|
|
|
|
|
const { project } = useProject() |
|
|
|
const { project } = useProject() |
|
|
|
|
|
|
|
|
|
|
@ -61,42 +61,43 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState( |
|
|
|
})) |
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
async function syncCount() { |
|
|
|
async function syncCount() { |
|
|
|
const { count } = await $api.dbViewRow.count( |
|
|
|
// const { count } = await $api.dbViewRow.count(
|
|
|
|
NOCO, |
|
|
|
// NOCO,
|
|
|
|
project?.value?.title as string, |
|
|
|
// project?.value?.title as string,
|
|
|
|
meta?.value?.id as string, |
|
|
|
// meta?.value?.id as string,
|
|
|
|
viewMeta?.value?.id as string, |
|
|
|
// viewMeta?.value?.id as string,
|
|
|
|
) |
|
|
|
// )
|
|
|
|
paginationData.value.totalRows = count |
|
|
|
// paginationData.value.totalRows = count
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function loadMapMeta() { |
|
|
|
async function loadMapMeta() { |
|
|
|
if (!viewMeta?.value?.id || !meta?.value?.columns) return |
|
|
|
alert('loadMapData') |
|
|
|
mapMetaData.value = await $api.dbView.mapRead(viewMeta.value.id) |
|
|
|
// if (!viewMeta?.value?.id || !meta?.value?.columns) return
|
|
|
|
geoDataFieldColumn.value = |
|
|
|
// mapMetaData.value = await $api.dbView.mapRead(viewMeta.value.id)
|
|
|
|
(meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {} |
|
|
|
// geoDataFieldColumn.value =
|
|
|
|
|
|
|
|
// (meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {}
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function loadMapData() { |
|
|
|
async function loadMapData() { |
|
|
|
if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic?.value) return |
|
|
|
// if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic?.value) return
|
|
|
|
|
|
|
|
|
|
|
|
const res = !isPublic.value |
|
|
|
// const res = !isPublic.value
|
|
|
|
? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, { |
|
|
|
// ? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, {
|
|
|
|
...queryParams.value, |
|
|
|
// ...queryParams.value,
|
|
|
|
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), |
|
|
|
// ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
|
|
|
|
where: where?.value, |
|
|
|
// where: where?.value,
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) |
|
|
|
// : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value })
|
|
|
|
|
|
|
|
|
|
|
|
formattedData.value = formatData(res.list) |
|
|
|
// formattedData.value = formatData(res.list)
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function updateMapMeta(updateObj: Partial<MapType>) { |
|
|
|
async function updateMapMeta(updateObj: Partial<MapType>) { |
|
|
|
if (!viewMeta?.value?.id || !isUIAllowed('xcDatatableEditable')) return |
|
|
|
// if (!viewMeta?.value?.id || !isUIAllowed('xcDatatableEditable')) return
|
|
|
|
await $api.dbView.mapUpdate(viewMeta.value.id, { |
|
|
|
// await $api.dbView.mapUpdate(viewMeta.value.id, {
|
|
|
|
...mapMetaData.value, |
|
|
|
// ...mapMetaData.value,
|
|
|
|
...updateObj, |
|
|
|
// ...updateObj,
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { getMeta } = useMetas() |
|
|
|
const { getMeta } = useMetas() |
|
|
|