|
|
@ -3,7 +3,16 @@ import type { ColumnType, LinkToAnotherRecordType, LookupType, SelectOptionsType |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { extractSdkResponseErrorMsg } from '../utils' |
|
|
|
import { extractSdkResponseErrorMsg } from '../utils' |
|
|
|
import { GROUP_BY_VARS, ref, storeToRefs, useApi, useBase, useMetas, useViewColumnsOrThrow } from '#imports' |
|
|
|
import { |
|
|
|
|
|
|
|
GROUP_BY_VARS, |
|
|
|
|
|
|
|
SharedViewPasswordInj, |
|
|
|
|
|
|
|
ref, |
|
|
|
|
|
|
|
storeToRefs, |
|
|
|
|
|
|
|
useApi, |
|
|
|
|
|
|
|
useBase, |
|
|
|
|
|
|
|
useMetas, |
|
|
|
|
|
|
|
useViewColumnsOrThrow, |
|
|
|
|
|
|
|
} from '#imports' |
|
|
|
import type { Group, GroupNestedIn, Row } from '#imports' |
|
|
|
import type { Group, GroupNestedIn, Row } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const excludedGroupingUidt = [UITypes.Attachment, UITypes.QrCode, UITypes.Barcode] |
|
|
|
const excludedGroupingUidt = [UITypes.Attachment, UITypes.QrCode, UITypes.Barcode] |
|
|
@ -25,6 +34,8 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed |
|
|
|
|
|
|
|
|
|
|
|
const { getMeta } = useMetas() |
|
|
|
const { getMeta } = useMetas() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sharedViewPassword = inject(SharedViewPasswordInj, ref(null)) |
|
|
|
|
|
|
|
|
|
|
|
const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => { |
|
|
|
const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => { |
|
|
|
const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = [] |
|
|
|
const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = [] |
|
|
|
Object.values(gridViewCols.value).forEach((col) => { |
|
|
|
Object.values(gridViewCols.value).forEach((col) => { |
|
|
@ -236,16 +247,24 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed |
|
|
|
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, |
|
|
|
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, |
|
|
|
column_name: groupby.column.title, |
|
|
|
column_name: groupby.column.title, |
|
|
|
} as any) |
|
|
|
} as any) |
|
|
|
: await api.public.dataGroupBy(sharedView.value!.uuid!, { |
|
|
|
: await api.public.dataGroupBy( |
|
|
|
offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value), |
|
|
|
sharedView.value!.uuid!, |
|
|
|
limit: group.paginationData.pageSize ?? groupByGroupLimit.value, |
|
|
|
{ |
|
|
|
...params, |
|
|
|
offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value), |
|
|
|
where: nestedWhere, |
|
|
|
limit: group.paginationData.pageSize ?? groupByGroupLimit.value, |
|
|
|
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, |
|
|
|
...params, |
|
|
|
column_name: groupby.column.title, |
|
|
|
where: nestedWhere, |
|
|
|
sortsArr: sorts.value, |
|
|
|
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, |
|
|
|
filtersArr: nestedFilters.value, |
|
|
|
column_name: groupby.column.title, |
|
|
|
}) |
|
|
|
sortsArr: sorts.value, |
|
|
|
|
|
|
|
filtersArr: nestedFilters.value, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
'xc-password': sharedViewPassword.value, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const tempList: Group[] = response.list.reduce((acc: Group[], curr: Record<string, any>) => { |
|
|
|
const tempList: Group[] = response.list.reduce((acc: Group[], curr: Record<string, any>) => { |
|
|
|
const keyExists = acc.find( |
|
|
|
const keyExists = acc.find( |
|
|
|